From c124a8931d1f2a1566ab16ba63275b6384815c65 Mon Sep 17 00:00:00 2001 From: tp Date: Fri, 2 Mar 2018 16:22:54 +0000 Subject: [PATCH] doc cleanup --- README.md | 7 +++---- doc/source/indexing.rst | 44 +++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 86cf95508a5d9..8cdab179afd27 100644 --- a/README.md +++ b/README.md @@ -106,9 +106,8 @@ Here are just a few of the things that pandas does well: - Make it [**easy to convert**][conversion] ragged, differently-indexed data in other Python and NumPy data structures into DataFrame objects - - Intelligent label-based [**slicing**][slicing], [**fancy - indexing**][fancy-indexing], and [**subsetting**][subsetting] of - large data sets + - Intelligent label-based [**slicing**][slicing], [**selecting**][selecting], + and [**subsetting**][subsetting] of large data sets - Intuitive [**merging**][merging] and [**joining**][joining] data sets - Flexible [**reshaping**][reshape] and [**pivoting**][pivot-table] of @@ -129,7 +128,7 @@ Here are just a few of the things that pandas does well: [groupby]: https://pandas.pydata.org/pandas-docs/stable/groupby.html#group-by-split-apply-combine [conversion]: https://pandas.pydata.org/pandas-docs/stable/dsintro.html#dataframe [slicing]: https://pandas.pydata.org/pandas-docs/stable/indexing.html#slicing-ranges - [fancy-indexing]: https://pandas.pydata.org/pandas-docs/stable/indexing.html#advanced-indexing-with-ix + [selecting]: https://pandas.pydata.org/pandas-docs/stable/indexing.html#selection-by-label [subsetting]: https://pandas.pydata.org/pandas-docs/stable/indexing.html#boolean-indexing [merging]: https://pandas.pydata.org/pandas-docs/stable/merging.html#database-style-dataframe-joining-merging [joining]: https://pandas.pydata.org/pandas-docs/stable/merging.html#joining-on-index diff --git a/doc/source/indexing.rst b/doc/source/indexing.rst index 750b260c7f228..4364d1ce48b1b 100644 --- a/doc/source/indexing.rst +++ b/doc/source/indexing.rst @@ -310,27 +310,6 @@ Selection By Label This is sometimes called ``chained assignment`` and should be avoided. See :ref:`Returning a View versus Copy `. -.. warning:: - - ``.loc`` is strict when you present slicers that are not compatible (or convertible) with the index type. For example - using integers in a ``DatetimeIndex``. These will raise a ``TypeError``. - - .. ipython:: python - - dfl = pd.DataFrame(np.random.randn(5,4), columns=list('ABCD'), index=pd.date_range('20130101',periods=5)) - dfl - - .. code-block:: ipython - - In [4]: dfl.loc[2:3] - TypeError: cannot do slice indexing on with these indexers [2] of - - String likes in slicing *can* be convertible to the type of the index and lead to natural slicing. - - .. ipython:: python - - dfl.loc['20130102':'20130104'] - .. warning:: Starting in 0.21.0, pandas will show a ``FutureWarning`` if indexing with a list with missing labels. In the future @@ -430,6 +409,29 @@ error will be raised (since doing otherwise would be computationally expensive, as well as potentially ambiguous for mixed type indexes). For instance, in the above example, ``s.loc[1:6]`` would raise ``KeyError``. +.. warning:: + + ``.loc`` is strict when you present slicers that are not compatible + (or convertible) with the index type. For example using integers in a + ``DatetimeIndex``. These will raise a ``TypeError``. + + .. ipython:: python + + dfl = pd.DataFrame(np.random.randn(5,4), columns=list('ABCD'), + index=pd.date_range('20130101',periods=5)) + dfl + + .. code-block:: ipython + + In [4]: dfl.loc[2:3] + TypeError: cannot do slice indexing on with these indexers [2] of + + String likes in slicing *can* be convertible to the type of the index and lead to natural slicing. + + .. ipython:: python + + dfl.loc['20130102':'20130104'] + .. _indexing.integer: Selection By Position