You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/indexing.rst
+58-5
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,10 @@ indexing.
43
43
standard operators has some optimization limits. For production code, we recommended
44
44
that you take advantage of the optimized pandas data access methods exposed in this chapter.
45
45
46
-
In addition, whether a copy or a reference is returned for a selection operation, may depend on the context.
46
+
.. warning::
47
+
48
+
Whether a copy or a reference is returned for a setting operation, may depend on the context.
49
+
This is sometimes called ``chained assignment`` and should be avoided.
47
50
See :ref:`Returning a View versus Copy <indexing.view_versus_copy>`
48
51
49
52
See the :ref:`cookbook<cookbook.selection>` for some advanced strategies
@@ -219,6 +222,12 @@ largely as a convenience since it is such a common operation.
219
222
Selection By Label
220
223
~~~~~~~~~~~~~~~~~~
221
224
225
+
.. warning::
226
+
227
+
Whether a copy or a reference is returned for a setting operation, may depend on the context.
228
+
This is sometimes called ``chained assignment`` and should be avoided.
229
+
See :ref:`Returning a View versus Copy <indexing.view_versus_copy>`
230
+
222
231
Pandas provides a suite of methods in order to have **purely label based indexing**. This is a strict inclusion based protocol.
223
232
**ALL** of the labels for which you ask, must be in the index or a ``KeyError`` will be raised! When slicing, the start bound is *included*, **AND** the stop bound is *included*. Integers are valid labels, but they refer to the label **and not the position**.
224
233
@@ -284,6 +293,12 @@ For getting a value explicity (equiv to deprecated ``df.get_value('a','A')``)
284
293
Selection By Position
285
294
~~~~~~~~~~~~~~~~~~~~~
286
295
296
+
.. warning::
297
+
298
+
Whether a copy or a reference is returned for a setting operation, may depend on the context.
299
+
This is sometimes called ``chained assignment`` and should be avoided.
300
+
See :ref:`Returning a View versus Copy <indexing.view_versus_copy>`
301
+
287
302
Pandas provides a suite of methods in order to get **purely integer based indexing**. The semantics follow closely python and numpy slicing. These are ``0-based`` indexing. When slicing, the start bounds is *included*, while the upper bound is *excluded*. Trying to use a non-integer, even a **valid** label will raise a ``IndexError``.
288
303
289
304
The ``.iloc`` attribute is the primary access method. The following are valid inputs:
@@ -822,11 +837,49 @@ In chained expressions, the order may determine whether a copy is returned or no
0 commit comments