Skip to content

Commit

Permalink
Improve comments, fix doc string errors
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Aug 31, 2018
1 parent 16c3103 commit 18a0de7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4382,8 +4382,8 @@ def duplicated(self, subset=None, keep='first', return_inverse=False):
set on False and all others on True:
>>> data = {'species': ['lama', 'cow', 'lama', 'ant', 'lama', 'bee'],
'type': ['mammal'] * 3 + ['insect', 'mammal', 'insect']}
>>> animals = pd.DataFrame(data, index=[1, 4, 9, 16, 25])
... 'type': ['mammal'] * 3 + ['insect', 'mammal', 'insect']}
>>> animals = pd.DataFrame(data, index=[1, 4, 9, 16, 25, 36])
>>> animals
species type
1 lama mammal
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,7 @@ def duplicated(self, keep='first', return_inverse=False):
set on False and all others on True:
>>> animals = pd.Series(['lama', 'cow', 'lama', 'beetle', 'lama'],
index=[1, 4, 9, 16, 25])
... index=[1, 4, 9, 16, 25])
>>> animals.duplicated()
1 False
4 False
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/indexes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,9 @@ def test_duplicated_inverse(self, indices, keep):
return_inverse=True)
tm.assert_numpy_array_equal(result_isdup, expected_isdup)

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

0 comments on commit 18a0de7

Please sign in to comment.