Skip to content

REGR: Regression in multi-index indexing with a non-scalar type object (GH7914) #7921

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

Merged
merged 1 commit into from
Aug 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/v0.15.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ Bug Fixes
- Bug in adding and subtracting ``PeriodIndex`` with ``PeriodIndex`` raise ``TypeError`` (:issue:`7741`)
- Bug in ``combine_first`` with ``PeriodIndex`` data raises ``TypeError`` (:issue:`3367`)
- Bug in multi-index slicing with missing indexers (:issue:`7866`)

- Regression in multi-index indexing with a non-scalar type object (:issue:`7914`)

- Bug in pickles contains ``DateOffset`` may raise ``AttributeError`` when ``normalize`` attribute is reffered internally (:issue:`7748`)

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ def _getitem_nested_tuple(self, tup):
axis += 1

# if we have a scalar, we are done
if np.isscalar(obj):
if np.isscalar(obj) or not hasattr(obj,'ndim'):
break

# has the dim of the obj changed?
Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,15 @@ def f():
result = s.loc[idx[:,['foo','bah']]]
assert_series_equal(result,expected)

# regression from < 0.14.0
# GH 7914
df = DataFrame([[np.mean, np.median],['mean','median']],
columns=MultiIndex.from_tuples([('functs','mean'),
('functs','median')]),
index=['function', 'name'])
result = df.loc['function',('functs','mean')]
self.assertEqual(result,np.mean)

def test_setitem_dtype_upcast(self):

# GH3216
Expand Down