Skip to content

Commit beb0812

Browse files
committed
DOC: edit indexing.rst a bit
1 parent f7c7ee0 commit beb0812

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

doc/source/indexing.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -1137,16 +1137,17 @@ should be taken instead.
11371137
df2.drop_duplicates(['a','b'])
11381138
df2.drop_duplicates(['a','b'], take_last=True)
11391139
1140-
An easier way to drop duplicates on the index than to temporarily forgo it is
1141-
``groupby(level=0)`` combined with ``first()`` or ``last()``.
1140+
An alternative way to drop duplicates on the index is ``.groupby(level=0)`` combined with ``first()`` or ``last()``.
11421141

11431142
.. ipython:: python
11441143
11451144
df3 = df2.set_index('b')
11461145
df3
1147-
df3.reset_index().drop_duplicates(subset='b', take_last=False).set_index('b')
11481146
df3.groupby(level=0).first()
11491147
1148+
# a bit more verbose
1149+
df3.reset_index().drop_duplicates(subset='b', take_last=False).set_index('b')
1150+
11501151
.. _indexing.dictionarylike:
11511152

11521153
Dictionary-like :meth:`~pandas.DataFrame.get` method

0 commit comments

Comments
 (0)