Skip to content

Commit c124a89

Browse files
author
tp
committed
doc cleanup
1 parent a7a7f8c commit c124a89

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,8 @@ Here are just a few of the things that pandas does well:
106106
- Make it [**easy to convert**][conversion] ragged,
107107
differently-indexed data in other Python and NumPy data structures
108108
into DataFrame objects
109-
- Intelligent label-based [**slicing**][slicing], [**fancy
110-
indexing**][fancy-indexing], and [**subsetting**][subsetting] of
111-
large data sets
109+
- Intelligent label-based [**slicing**][slicing], [**selecting**][selecting],
110+
and [**subsetting**][subsetting] of large data sets
112111
- Intuitive [**merging**][merging] and [**joining**][joining] data
113112
sets
114113
- Flexible [**reshaping**][reshape] and [**pivoting**][pivot-table] of
@@ -129,7 +128,7 @@ Here are just a few of the things that pandas does well:
129128
[groupby]: https://pandas.pydata.org/pandas-docs/stable/groupby.html#group-by-split-apply-combine
130129
[conversion]: https://pandas.pydata.org/pandas-docs/stable/dsintro.html#dataframe
131130
[slicing]: https://pandas.pydata.org/pandas-docs/stable/indexing.html#slicing-ranges
132-
[fancy-indexing]: https://pandas.pydata.org/pandas-docs/stable/indexing.html#advanced-indexing-with-ix
131+
[selecting]: https://pandas.pydata.org/pandas-docs/stable/indexing.html#selection-by-label
133132
[subsetting]: https://pandas.pydata.org/pandas-docs/stable/indexing.html#boolean-indexing
134133
[merging]: https://pandas.pydata.org/pandas-docs/stable/merging.html#database-style-dataframe-joining-merging
135134
[joining]: https://pandas.pydata.org/pandas-docs/stable/merging.html#joining-on-index

doc/source/indexing.rst

+23-21
Original file line numberDiff line numberDiff line change
@@ -310,27 +310,6 @@ Selection By Label
310310
This is sometimes called ``chained assignment`` and should be avoided.
311311
See :ref:`Returning a View versus Copy <indexing.view_versus_copy>`.
312312

313-
.. warning::
314-
315-
``.loc`` is strict when you present slicers that are not compatible (or convertible) with the index type. For example
316-
using integers in a ``DatetimeIndex``. These will raise a ``TypeError``.
317-
318-
.. ipython:: python
319-
320-
dfl = pd.DataFrame(np.random.randn(5,4), columns=list('ABCD'), index=pd.date_range('20130101',periods=5))
321-
dfl
322-
323-
.. code-block:: ipython
324-
325-
In [4]: dfl.loc[2:3]
326-
TypeError: cannot do slice indexing on <class 'pandas.tseries.index.DatetimeIndex'> with these indexers [2] of <type 'int'>
327-
328-
String likes in slicing *can* be convertible to the type of the index and lead to natural slicing.
329-
330-
.. ipython:: python
331-
332-
dfl.loc['20130102':'20130104']
333-
334313
.. warning::
335314

336315
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,
430409
as well as potentially ambiguous for mixed type indexes). For instance, in the
431410
above example, ``s.loc[1:6]`` would raise ``KeyError``.
432411

412+
.. warning::
413+
414+
``.loc`` is strict when you present slicers that are not compatible
415+
(or convertible) with the index type. For example using integers in a
416+
``DatetimeIndex``. These will raise a ``TypeError``.
417+
418+
.. ipython:: python
419+
420+
dfl = pd.DataFrame(np.random.randn(5,4), columns=list('ABCD'),
421+
index=pd.date_range('20130101',periods=5))
422+
dfl
423+
424+
.. code-block:: ipython
425+
426+
In [4]: dfl.loc[2:3]
427+
TypeError: cannot do slice indexing on <class 'pandas.tseries.index.DatetimeIndex'> with these indexers [2] of <type 'int'>
428+
429+
String likes in slicing *can* be convertible to the type of the index and lead to natural slicing.
430+
431+
.. ipython:: python
432+
433+
dfl.loc['20130102':'20130104']
434+
433435
.. _indexing.integer:
434436

435437
Selection By Position

0 commit comments

Comments
 (0)