Skip to content

Commit a72149f

Browse files
committed
TST: fix up for 32-bit indexers w.r.t. (GH8669)
1 parent 9f15bea commit a72149f

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

pandas/core/internals.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -551,29 +551,31 @@ def setitem(self, indexer, value):
551551
try:
552552

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

557556
if arr_value.ndim == 1:
558557
if not isinstance(indexer, tuple):
559558
indexer = tuple([indexer])
559+
return all([ np.isscalar(idx) for idx in indexer ])
560+
return False
560561

561-
def _is_ok(idx):
562-
563-
if np.isscalar(idx):
564-
return True
565-
elif isinstance(idx, slice):
566-
return False
567-
return len(idx) == 0
562+
def _is_empty_indexer(indexer):
563+
# return a boolean if we have an empty indexer
568564

569-
return all([ _is_ok(idx) for idx in indexer ])
565+
if arr_value.ndim == 1:
566+
if not isinstance(indexer, tuple):
567+
indexer = tuple([indexer])
568+
return all([ isinstance(idx, np.ndarray) and len(idx) == 0 for idx in indexer ])
570569
return False
571570

571+
# empty indexers
572+
# 8669 (empty)
573+
if _is_empty_indexer(indexer):
574+
pass
572575

573576
# setting a single element for each dim and with a rhs that could be say a list
574-
# or empty indexers (so no astyping)
575-
# GH 6043, 8669 (empty)
576-
if _is_scalar_indexer(indexer):
577+
# GH 6043
578+
elif _is_scalar_indexer(indexer):
577579
values[indexer] = value
578580

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy