-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: duplicate indexing with embedded non-orderables (#17610) #17851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #17851 +/- ##
==========================================
- Coverage 91.25% 91.21% -0.05%
==========================================
Files 163 163
Lines 50038 50039 +1
==========================================
- Hits 45661 45641 -20
- Misses 4377 4398 +21
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #17851 +/- ##
==========================================
- Coverage 91.23% 91.22% -0.02%
==========================================
Files 163 163
Lines 50112 50112
==========================================
- Hits 45722 45713 -9
- Misses 4390 4399 +9
Continue to review full report at Codecov.
|
pandas/tests/series/test_indexing.py
Outdated
@@ -546,6 +546,21 @@ def test_getitem_setitem_periodindex(self): | |||
result[4:8] = ts[4:8] | |||
assert_series_equal(result, ts) | |||
|
|||
def test_getitem_with_duplicates_indices(self): | |||
s = pd.Series({1: 12, 2: [1, 2, 2, 3]}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the github issue number as a comment here?
pandas/core/series.py
Outdated
@@ -626,9 +626,10 @@ def __getitem__(self, key): | |||
# we need to box if we have a non-unique index here | |||
# otherwise have inline ndarray/lists | |||
if not self.index.is_unique: | |||
result = self._constructor( | |||
result, index=[key] * len(result), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to do something like
index = self.index[self.index.get_loc(key)]
@@ -978,6 +978,7 @@ Indexing | |||
- Bug in :meth:`DataFrame.first_valid_index` and :meth:`DataFrame.last_valid_index` when no valid entry (:issue:`17400`) | |||
- Bug in :func:`Series.rename` when called with a callable, incorrectly alters the name of the ``Series``, rather than the name of the ``Index``. (:issue:`17407`) | |||
- Bug in :func:`String.str_get` raises ``IndexError`` instead of inserting NaNs when using a negative index. (:issue:`17704`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to 0.21.1
can you rebase / update |
BUG: duplicate indexing with embedded non-orderables (#17610)
git diff upstream/master -u -- "*.py" | flake8 --diff