-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: isin Example for .13 release notes #4848
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
Conversation
mask = df.isin({'A': [1, 2], 'B': ['e', 'f']}) | ||
df[mask.all(1)] | ||
|
||
See :ref:`Boolean Indexing<indexing.boolean>` for more. |
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.
this looks right, but I would add a reference, say indexing.isin (and maybe it a separate sub-section, where you put the series/frame cases). You can build the docs locally to see how it looks
Okay, I moved the Series and DataFrame isin sections of So pending a decision on how to handle #4421, which I don't have time to get to today, I think this is ready to go. Off topic: @jreback were you aware that the I wanted to check before making an issue. |
@TomAugspurger you mean the timedeltas are so broken in 1.6 that only very limited ops can be done |
|
||
.. ipython:: python | ||
|
||
df2 = DataFrame({'a' : ['one', 'one', 'two', 'three', 'two', 'one', 'six'], |
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.
can you also add a simple Series example? (series indexed by the same series)
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.
I mean to switch the line you commented on to a Series.
You mean like
ser = Series(['one', 'one', 'two', 'three', 'two', 'one', 'six'])
ser.isin(['one', 'two'])
seri[ser.isin(['one', 'two'])]
?
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.
no your example was fine, maybe something that uses integers or something? just a pure Series (before you do the DataFrame example)
In [2]: s = Series(np.arange(10),index=np.arange(10)[::-1],dtype='int64')
In [3]: s
Out[3]:
9 0
8 1
7 2
6 3
5 4
4 5
3 6
2 7
1 8
0 9
dtype: int64
In [5]: s[s.isin([2,4])]
Out[5]:
7 2
5 4
dtype: int64
Added the Series example. |
perfect..thanks |
@TomAugspurger can your rebase this and can get in |
@jreback rebased… but the typo fixes I made in my second commit got tangled up with some changes someone (probably you) made to the HDF5 notes. Lines 35-109 my PR. Should I go back to before my rebase and do it again with just the changes in my first commit? There's a way to select which commits get applied right? |
|
DOC: Create isin indexing section and link whats new to it DOC: Change series.isin example.
Ok, should be good to go. |
DOC: isin Example for .13 release notes
gre8 thanks |
@TomAugspurger @hayd I slightly changed the isin example in v0.13.0 (because it got moved and df was not defined correctly). Pls verify it and change if needed. |
Looks good. |
I also fixed a few typos in a separate commit. I can remove that commit if they're going to cause conflicts.
Also did I get the syntax correct for this link?