Skip to content

Commit 5aa53c6

Browse files
committed
making the recommended way explicit
1 parent de9f6bd commit 5aa53c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/source/user_guide/indexing.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,20 +1866,20 @@ A chained assignment can also crop up in setting in a mixed dtype frame.
18661866

18671867
These setting rules apply to all of ``.loc/.iloc``.
18681868

1869-
This is the correct access method:
1869+
The following is the recommended access method using ``.loc`` for multiple items (using ``mask``) and a single item using a fixed index:
18701870

18711871
.. ipython:: python
18721872
18731873
dfc = pd.DataFrame({'a': ['one', 'one', 'two',
18741874
'three', 'two', 'one', 'six'],
18751875
'c': np.arange(7)})
18761876
dfd = dfc.copy()
1877-
# Setting multiple items using a mask (recommended)
1877+
# Setting multiple items using a mask
18781878
mask = dfd['a'].str.startswith('o')
18791879
dfd.loc[mask, 'c'] = 42
18801880
dfd
18811881
1882-
# Setting a single item (recommended)
1882+
# Setting a single item
18831883
dfd = dfc.copy()
18841884
dfd.loc[2, 'a'] = 11
18851885
dfd

0 commit comments

Comments
 (0)