Skip to content

Commit 18a0de7

Browse files
committed
Improve comments, fix doc string errors
1 parent 16c3103 commit 18a0de7

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

pandas/core/frame.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4382,8 +4382,8 @@ def duplicated(self, subset=None, keep='first', return_inverse=False):
43824382
set on False and all others on True:
43834383
43844384
>>> data = {'species': ['lama', 'cow', 'lama', 'ant', 'lama', 'bee'],
4385-
'type': ['mammal'] * 3 + ['insect', 'mammal', 'insect']}
4386-
>>> animals = pd.DataFrame(data, index=[1, 4, 9, 16, 25])
4385+
... 'type': ['mammal'] * 3 + ['insect', 'mammal', 'insect']}
4386+
>>> animals = pd.DataFrame(data, index=[1, 4, 9, 16, 25, 36])
43874387
>>> animals
43884388
species type
43894389
1 lama mammal

pandas/core/series.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,7 @@ def duplicated(self, keep='first', return_inverse=False):
16331633
set on False and all others on True:
16341634
16351635
>>> animals = pd.Series(['lama', 'cow', 'lama', 'beetle', 'lama'],
1636-
index=[1, 4, 9, 16, 25])
1636+
... index=[1, 4, 9, 16, 25])
16371637
>>> animals.duplicated()
16381638
1 False
16391639
4 False

pandas/tests/indexes/common.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,9 @@ def test_duplicated_inverse(self, indices, keep):
406406
return_inverse=True)
407407
tm.assert_numpy_array_equal(result_isdup, expected_isdup)
408408

409-
# test that result_inv works (and fits together with expected_isdup)
409+
# the following tests the correctness of result_inv in two ways:
410+
# - it needs to fit together with expected_isdup
411+
# - it needs to correctly reconstruct the object
410412
unique = idx[~expected_isdup]
411413
reconstr = unique[result_inv]
412414
tm.assert_index_equal(reconstr, idx)

0 commit comments

Comments
 (0)