Skip to content

DOC: tweak paragraph regarding cut and IntervalIndex #27132

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 4 commits into from Jun 30, 2019
Merged

DOC: tweak paragraph regarding cut and IntervalIndex #27132

merged 4 commits into from Jun 30, 2019

Conversation

ghost
Copy link

@ghost ghost commented Jun 29, 2019

I thought this paragraph could be improved, so I tried to.


.. ipython:: python

c = pd.cut(range(4), bins=2)
c
c.categories

Furthermore, ``IntervalIndex`` allows one to bin *other* data with these same
bins, with ``NaN`` representing a missing value similar to other dtypes.
:func:`cut` also accepts an ``IntervalIndex`` for its `bins` argument, which enables
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double backticks for anything that is not a role here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@WillAyd WillAyd added the Docs label Jun 30, 2019

.. ipython:: python

pd.cut([0, 3, 5, 1], bins=c.categories)

When :func:`cut` is passed an ``IntervalIndex`` for the `bins` argument, The ``Interval``
values in the ``IntervalIndex`` define the bins and any value which falls outside all
bins will be assigned a ``NaN`` value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep it to the last part here (the former is already explained before the example), like "Values that fall outside the passed Intervals will be assigned a NaN value".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Updated.

@jorisvandenbossche jorisvandenbossche merged commit b870dee into pandas-dev:master Jun 30, 2019
@jorisvandenbossche
Copy link
Member

@pilkibun Thanks!

@jorisvandenbossche jorisvandenbossche added this to the 0.25.0 milestone Jun 30, 2019
@ghost ghost deleted the doc_IntervalIndex branch July 31, 2019 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants