-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: fix DataFrame.isin docstring and doctests #22767
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 1 commit
0d3ebaa
3684653
82530fa
b5af788
a781439
e59e69f
938a21f
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 |
---|---|---|
|
@@ -7430,8 +7430,7 @@ def to_period(self, freq=None, axis=0, copy=True): | |
|
||
def isin(self, values): | ||
""" | ||
Return boolean DataFrame showing whether each element in the | ||
DataFrame is contained in values. | ||
Whether each element in the DataFrame is contained in values. | ||
|
||
Parameters | ||
---------- | ||
|
@@ -7444,8 +7443,9 @@ def isin(self, values): | |
|
||
Returns | ||
------- | ||
|
||
DataFrame of booleans | ||
DataFrame | ||
DataFrame of boolean showing whether each element in the DataFrame | ||
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. boolean -> booleans |
||
is contained in values. | ||
|
||
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. Can we add a |
||
Examples | ||
-------- | ||
|
@@ -7458,23 +7458,24 @@ def isin(self, values): | |
1 False False | ||
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. Can you start the example before the "when values is a list" with the constructor, and displaying the content of the original Dataframe (i.e. Also, I think the docstring would be clearer if we use a more real world example. For example, if the index is an animal name, and the columns are |
||
2 True False | ||
|
||
When ``values`` is a dict: | ||
When ``values`` is a dict. Note that B doesn't match the 1 here. | ||
|
||
>>> df = pd.DataFrame({'A': [1, 2, 3], 'B': [1, 4, 7]}) | ||
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 it's better if we can use the same DataFrame for all the examples. |
||
>>> df.isin({'A': [1, 3], 'B': [4, 7, 12]}) | ||
A B | ||
0 True False # Note that B didn't match the 1 here. | ||
0 True False | ||
1 False True | ||
2 True True | ||
|
||
When ``values`` is a Series or DataFrame: | ||
When ``values`` is a Series or DataFrame. Column A in `df2` has a | ||
3, but not at index 1. | ||
|
||
>>> df = pd.DataFrame({'A': [1, 2, 3], 'B': ['a', 'b', 'f']}) | ||
>>> df2 = pd.DataFrame({'A': [1, 3, 3, 2], 'B': ['e', 'f', 'f', 'e']}) | ||
>>> df.isin(df2) | ||
A B | ||
0 True False | ||
1 False False # Column A in `df2` has a 3, but not at index 1. | ||
1 False False | ||
2 True True | ||
""" | ||
if isinstance(values, dict): | ||
|
Uh oh!
There was an error while loading. Please reload this page.