Skip to content

Commit fe719ae

Browse files
committed
Make requested changes
Use pandas is_scalar, remove deprecated constructor, add GH issue number to test
1 parent 4aa4c02 commit fe719ae

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
@@ -1066,7 +1066,7 @@ def take(
10661066
):
10671067
if kwargs:
10681068
nv.validate_take((), kwargs)
1069-
if np.isscalar(indices):
1069+
if is_scalar(indices):
10701070
raise TypeError("Expected indices to be array-like")
10711071
indices = ensure_platform_int(indices)
10721072
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)