Skip to content

Commit

Permalink
more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Apr 13, 2017
1 parent e5f8082 commit b2d26eb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
33 changes: 33 additions & 0 deletions doc/source/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,39 @@ Of course if you need integer based selection, then use ``iloc``
dfir.iloc[0:5]
.. _indexing.intervallindex:
IntervalIndex
~~~~~~~~~~~~~
.. versionadded:: 0.20.0
.. warning::
These indexing behaviors are provisional and may change in a future version of pandas.
.. ipython:: python
df = pd.DataFrame({'A': [1, 2, 3, 4]},
index=pd.IntervalIndex.from_breaks([0, 1, 2, 3, 4]))
df
Label based indexing via ``.loc`` along the edges of an interval works as you would expect,
selecting that particular interval.
.. ipython:: python
df.loc[2]
df.loc[[2, 3]]
If you select a lable *contained* within an interval, this will also select the interval.
.. ipython:: python
df.loc[2.5]
df.loc[[2.5, 3.5]]
Miscellaneous indexing FAQ
--------------------------
Expand Down
3 changes: 2 additions & 1 deletion doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ IntervalIndex
^^^^^^^^^^^^^

pandas has gain an ``IntervalIndex`` with its own dtype, ``interval`` as well as the ``Interval`` scalar type. These allow first-class support for interval
notation, specifically as return type for ``pd.cut`` and ``pd.qcut``. (:issue:`7640`, :issue:`8625`)
notation, specifically as return type for ``pd.cut`` and ``pd.qcut``. The ``IntervalIndex`` allows some unique indexing, see the
:ref:`docs <indexing.intervallindex>`. (:issue:`7640`, :issue:`8625`)

**Previous behavior**:

Expand Down

0 comments on commit b2d26eb

Please sign in to comment.