Skip to content

TST: fix up for 32-bit indexers w.r.t. (GH8669) #8675

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
Oct 29, 2014
Merged
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
26 changes: 14 additions & 12 deletions pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,29 +551,31 @@ def setitem(self, indexer, value):
try:

def _is_scalar_indexer(indexer):
# treat a len 0 array like a scalar
# return True if we are all scalar indexers

if arr_value.ndim == 1:
if not isinstance(indexer, tuple):
indexer = tuple([indexer])
return all([ np.isscalar(idx) for idx in indexer ])
return False

def _is_ok(idx):

if np.isscalar(idx):
return True
elif isinstance(idx, slice):
return False
return len(idx) == 0
def _is_empty_indexer(indexer):
# return a boolean if we have an empty indexer

return all([ _is_ok(idx) for idx in indexer ])
if arr_value.ndim == 1:
if not isinstance(indexer, tuple):
indexer = tuple([indexer])
return all([ isinstance(idx, np.ndarray) and len(idx) == 0 for idx in indexer ])
return False

# empty indexers
# 8669 (empty)
if _is_empty_indexer(indexer):
pass

# setting a single element for each dim and with a rhs that could be say a list
# or empty indexers (so no astyping)
# GH 6043, 8669 (empty)
if _is_scalar_indexer(indexer):
# GH 6043
elif _is_scalar_indexer(indexer):
values[indexer] = value

# if we are an exact match (ex-broadcasting),
Expand Down