Skip to content

Commit 8851d7f

Browse files
committed
Make requested changes
Use pandas is_scalar, remove deprecated constructor, add GH issue number to test
1 parent 12b7428 commit 8851d7f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pandas/core/indexes/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ def take(
10591059
):
10601060
if kwargs:
10611061
nv.validate_take((), kwargs)
1062-
if np.isscalar(indices):
1062+
if is_scalar(indices):
10631063
raise TypeError("Expected indices to be array-like")
10641064
indices = ensure_platform_int(indices)
10651065
allow_fill = self._maybe_disallow_fill(allow_fill, fill_value, indices)

pandas/tests/indexes/test_indexing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ def test_take(self, index):
7171
index.freq
7272

7373
def test_take_indexer_type(self):
74-
integer_index = Int64Index([0, 1, 2, 3])
74+
# GH#42875
75+
integer_index = Index([0, 1, 2, 3])
7576
scalar_index = 1
7677
msg = "Expected indices to be array-like"
7778
with pytest.raises(TypeError, match=msg):

0 commit comments

Comments
 (0)