Skip to content

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

Merged
merged 1 commit into from
Sep 30, 2013

Conversation

TomAugspurger
Copy link
Contributor

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?

See :ref:Boolean Indexing<indexing.boolean> for more

mask = df.isin({'A': [1, 2], 'B': ['e', 'f']})
df[mask.all(1)]

See :ref:`Boolean Indexing<indexing.boolean>` for more.
Copy link
Contributor

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

@TomAugspurger
Copy link
Contributor Author

Okay, I moved the Series and DataFrame isin sections of indexing.rst into their own subsection under Basics.

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 to_datetime examples in What's New are failing? http://pandas.pydata.org/pandas-docs/dev/whatsnew.html#enhancements

I wanted to check before making an issue.

@jreback
Copy link
Contributor

jreback commented Sep 16, 2013

@TomAugspurger you mean the to_timedelta ones.....do you see that big warning about requiring numpy 1.7, unfortunately the build machine (which @changhiskhan / @wesm) run runs 1.6.2 :(.

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'],
Copy link
Contributor

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)

Copy link
Contributor Author

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'])]

?

Copy link
Contributor

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

@TomAugspurger
Copy link
Contributor Author

Added the Series example.

@jreback
Copy link
Contributor

jreback commented Sep 16, 2013

perfect..thanks

@jreback
Copy link
Contributor

jreback commented Sep 30, 2013

@TomAugspurger can your rebase this and can get in

@TomAugspurger
Copy link
Contributor Author

@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?

@jreback
Copy link
Contributor

jreback commented Sep 30, 2013

git rebase -i upstream/master should work

DOC: Create isin indexing section and link whats new to it

DOC:  Change series.isin example.
@TomAugspurger
Copy link
Contributor Author

Ok, should be good to go.

jreback added a commit that referenced this pull request Sep 30, 2013
DOC: isin Example for .13 release notes
@jreback jreback merged commit c72d978 into pandas-dev:master Sep 30, 2013
@jreback
Copy link
Contributor

jreback commented Sep 30, 2013

gre8 thanks

@jreback
Copy link
Contributor

jreback commented Oct 1, 2013

@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.

@TomAugspurger
Copy link
Contributor Author

Looks good.

@TomAugspurger TomAugspurger deleted the isin_notes2 branch April 5, 2017 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants