Skip to content

Commit c10dd1a

Browse files
authored
BUG: Post-merge fixup, raise on dimension-expanding (#40365)
1 parent 6a9cc5c commit c10dd1a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pandas/core/internals/managers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,6 +1647,9 @@ def getitem_mgr(self, indexer) -> SingleBlockManager:
16471647
# similar to get_slice, but not restricted to slice indexer
16481648
blk = self._block
16491649
array = blk._slice(indexer)
1650+
if array.ndim > blk.values.ndim:
1651+
# This will be caught by Series._get_values
1652+
raise ValueError("dimension-expanding indexing not allowed")
16501653
block = blk.make_block_same_class(array, placement=slice(0, len(array)))
16511654
return type(self)(block, self.index[indexer])
16521655

0 commit comments

Comments
 (0)