-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: fix the pandas.DataFrame.add example #20077
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
d58c4fe
736972d
2e36068
5833bb6
ca3e5f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -477,16 +477,16 @@ def _get_op_name(op, special): | |
Examples | ||
-------- | ||
>>> a = pd.DataFrame([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'], | ||
columns=['one']) | ||
... columns=['one']) | ||
>>> a | ||
one | ||
a 1.0 | ||
b 1.0 | ||
c 1.0 | ||
d NaN | ||
>>> b = pd.DataFrame(dict(one=[1, np.nan, 1, np.nan], | ||
two=[np.nan, 2, np.nan, 2]), | ||
index=['a', 'b', 'd', 'e']) | ||
... two=[np.nan, 2, np.nan, 2]), | ||
... index=['a', 'b', 'd', 'e']) | ||
>>> b | ||
one two | ||
a 1.0 NaN | ||
|
@@ -513,14 +513,14 @@ def _get_op_name(op, special): | |
other : Series, DataFrame, or constant | ||
axis : {{0, 1, 'index', 'columns'}} | ||
For Series input, axis to match Series index on | ||
level : int or name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think @jorisvandenbossche what should our policy be on index positions or labels? In principle, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, yes, this is a dubious one. "name" is technically not a 'type', but "str" would not be correct as you say. So maybe better to keep it that way. If we keep the 'name' or 'label', wouldn't 'name' be better because it is here a index level name, not a label inside the index ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, yes you're right I was mistaken. And we can declare that "name" means anything that can go in |
||
Broadcast across a level, matching Index values on the | ||
passed MultiIndex level | ||
fill_value : None or float value, default None | ||
Fill existing missing (NaN) values, and any new element needed for | ||
successful DataFrame alignment, with this value before computation. | ||
If data in both corresponding DataFrame locations is missing | ||
the result will be missing | ||
level : int or name | ||
Broadcast across a level, matching Index values on the | ||
passed MultiIndex level | ||
|
||
Notes | ||
----- | ||
|
@@ -533,16 +533,16 @@ def _get_op_name(op, special): | |
Examples | ||
-------- | ||
>>> a = pd.DataFrame([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'], | ||
columns=['one']) | ||
... columns=['one']) | ||
>>> a | ||
one | ||
a 1.0 | ||
b 1.0 | ||
c 1.0 | ||
d NaN | ||
>>> b = pd.DataFrame(dict(one=[1, np.nan, 1, np.nan], | ||
two=[np.nan, 2, np.nan, 2]), | ||
index=['a', 'b', 'd', 'e']) | ||
... two=[np.nan, 2, np.nan, 2]), | ||
... index=['a', 'b', 'd', 'e']) | ||
>>> b | ||
one two | ||
a 1.0 NaN | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May need one more space here, so that the "i" in "index" is below the "d" in "dict'.