Skip to content

Commit 4a19a2b

Browse files
committed
Revert "np.int_ -> np.intp"
This reverts commit d759966.
1 parent 05329df commit 4a19a2b

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

pandas/tests/groupby/aggregate/test_cython.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def test_cython_agg_empty_buckets_nanops(observed):
212212
# GH-18869 can't call nanops on empty groups, so hardcode expected
213213
# for these
214214
df = DataFrame([11, 12, 13], columns=["a"])
215-
grps = np.arange(0, 25, 5, dtype=np.intp)
215+
grps = np.arange(0, 25, 5, dtype=np.int_)
216216
# add / sum
217217
result = df.groupby(pd.cut(df["a"], grps), observed=observed)._cython_agg_general(
218218
"sum", alt=None, numeric_only=True

pandas/tests/groupby/test_min_max.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_max_inat_not_all_na():
108108

109109
# Note: in converting to float64, the iNaT + 1 maps to iNaT, i.e. is lossy
110110
expected = Series({1: np.nan, 2: np.nan, 3: iNaT + 1})
111-
expected.index = expected.index.astype(np.intp)
111+
expected.index = expected.index.astype(np.int_)
112112
tm.assert_series_equal(result, expected, check_exact=True)
113113

114114

pandas/tests/groupby/test_nunique.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def test_nunique_preserves_column_level_names():
172172
# GH 23222
173173
test = DataFrame([1, 2, 2], columns=pd.Index(["A"], name="level_0"))
174174
result = test.groupby([0, 0, 0]).nunique()
175-
expected = DataFrame([2], index=np.array([0], dtype=np.intp), columns=test.columns)
175+
expected = DataFrame([2], index=np.array([0], dtype=np.int_), columns=test.columns)
176176
tm.assert_frame_equal(result, expected)
177177

178178

pandas/tests/groupby/test_size.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_size_axis_1(df, axis_1, by, sort, dropna):
3737
if sort:
3838
expected = expected.sort_index()
3939
if tm.is_integer_dtype(expected.index) and not any(x is None for x in by):
40-
expected.index = expected.index.astype(np.intp)
40+
expected.index = expected.index.astype(np.int_)
4141

4242
grouped = df.groupby(by=by, axis=axis_1, sort=sort, dropna=dropna)
4343
result = grouped.size()

pandas/tests/indexing/multiindex/test_partial.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def test_getitem_intkey_leading_level(
156156
mi = ser.index
157157
assert isinstance(mi, MultiIndex)
158158
if dtype is int:
159-
assert mi.levels[0].dtype == np.intp
159+
assert mi.levels[0].dtype == np.int_
160160
else:
161161
assert mi.levels[0].dtype == np.float64
162162

pandas/tests/indexing/test_loc.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def test_loc_to_fail(self):
436436
)
437437

438438
msg = (
439-
rf"\"None of \[NumericIndex\(\[1, 2\], dtype='{np.intp().dtype}'\)\] are "
439+
rf"\"None of \[NumericIndex\(\[1, 2\], dtype='{np.int_().dtype}'\)\] are "
440440
r"in the \[index\]\""
441441
)
442442
with pytest.raises(KeyError, match=msg):
@@ -454,7 +454,7 @@ def test_loc_to_fail2(self):
454454
s.loc[-1]
455455

456456
msg = (
457-
rf"\"None of \[NumericIndex\(\[-1, -2\], dtype='{np.intp().dtype}'\)\] are "
457+
rf"\"None of \[NumericIndex\(\[-1, -2\], dtype='{np.int_().dtype}'\)\] are "
458458
r"in the \[index\]\""
459459
)
460460
with pytest.raises(KeyError, match=msg):
@@ -470,7 +470,7 @@ def test_loc_to_fail2(self):
470470

471471
s["a"] = 2
472472
msg = (
473-
rf"\"None of \[NumericIndex\(\[-2\], dtype='{np.intp().dtype}'\)\] are "
473+
rf"\"None of \[NumericIndex\(\[-2\], dtype='{np.int_().dtype}'\)\] are "
474474
r"in the \[index\]\""
475475
)
476476
with pytest.raises(KeyError, match=msg):
@@ -487,7 +487,7 @@ def test_loc_to_fail3(self):
487487
df = DataFrame([["a"], ["b"]], index=[1, 2], columns=["value"])
488488

489489
msg = (
490-
rf"\"None of \[NumericIndex\(\[3\], dtype='{np.intp().dtype}'\)\] are "
490+
rf"\"None of \[NumericIndex\(\[3\], dtype='{np.int_().dtype}'\)\] are "
491491
r"in the \[index\]\""
492492
)
493493
with pytest.raises(KeyError, match=msg):
@@ -505,7 +505,7 @@ def test_loc_getitem_list_with_fail(self):
505505
s.loc[[2]]
506506

507507
msg = (
508-
f"\"None of [NumericIndex([3], dtype='{np.intp().dtype}')] "
508+
f"\"None of [NumericIndex([3], dtype='{np.int_().dtype}')] "
509509
'are in the [index]"'
510510
)
511511
with pytest.raises(KeyError, match=re.escape(msg)):
@@ -1195,7 +1195,7 @@ def test_loc_setitem_empty_append_raises(self):
11951195
df = DataFrame(columns=["x", "y"])
11961196
df.index = df.index.astype(np.int64)
11971197
msg = (
1198-
rf"None of \[NumericIndex\(\[0, 1\], dtype='{np.intp().dtype}'\)\] "
1198+
rf"None of \[NumericIndex\(\[0, 1\], dtype='{np.int_().dtype}'\)\] "
11991199
r"are in the \[index\]"
12001200
)
12011201
with pytest.raises(KeyError, match=msg):

pandas/tests/indexing/test_partial.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def test_series_partial_set(self):
403403

404404
# raises as nothing is in the index
405405
msg = (
406-
rf"\"None of \[NumericIndex\(\[3, 3, 3\], dtype='{np.intp().dtype}'\)\] "
406+
rf"\"None of \[NumericIndex\(\[3, 3, 3\], dtype='{np.int_().dtype}'\)\] "
407407
r"are in the \[index\]\""
408408
)
409409
with pytest.raises(KeyError, match=msg):
@@ -484,7 +484,7 @@ def test_series_partial_set_with_name(self):
484484

485485
# raises as nothing is in the index
486486
msg = (
487-
rf"\"None of \[NumericIndex\(\[3, 3, 3\], dtype='{np.intp().dtype}', "
487+
rf"\"None of \[NumericIndex\(\[3, 3, 3\], dtype='{np.int_().dtype}', "
488488
r"name='idx'\)\] are in the \[index\]\""
489489
)
490490
with pytest.raises(KeyError, match=msg):

pandas/tests/reshape/merge/test_merge.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def test_merge_join_key_dtype_cast(self):
355355
lkey = np.array([1])
356356
rkey = np.array([2])
357357
df = merge(df1, df2, left_on=lkey, right_on=rkey, how="outer")
358-
assert df["key_0"].dtype == np.intp
358+
assert df["key_0"].dtype == np.int_
359359

360360
def test_handle_join_key_pass_array(self):
361361
left = DataFrame(
@@ -379,7 +379,7 @@ def test_handle_join_key_pass_array(self):
379379
rkey = np.array([1, 1, 2, 3, 4, 5])
380380

381381
merged = merge(left, right, left_on=lkey, right_on=rkey, how="outer")
382-
expected = Series([1, 1, 1, 1, 2, 2, 3, 4, 5], dtype=np.intp, name="key_0")
382+
expected = Series([1, 1, 1, 1, 2, 2, 3, 4, 5], dtype=np.int_, name="key_0")
383383
tm.assert_series_equal(merged["key_0"], expected)
384384

385385
left = DataFrame({"value": np.arange(3)})

pandas/tests/series/test_repr.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def test_categorical_series_repr(self):
333333
8 8
334334
9 9
335335
dtype: category
336-
Categories (10, {np.intp().dtype}): [0, 1, 2, 3, ..., 6, 7, 8, 9]"""
336+
Categories (10, {np.int_().dtype}): [0, 1, 2, 3, ..., 6, 7, 8, 9]"""
337337

338338
assert repr(s) == exp
339339

@@ -359,7 +359,7 @@ def test_categorical_series_repr_ordered(self):
359359
8 8
360360
9 9
361361
dtype: category
362-
Categories (10, {np.intp().dtype}): [0 < 1 < 2 < 3 ... 6 < 7 < 8 < 9]"""
362+
Categories (10, {np.int_().dtype}): [0 < 1 < 2 < 3 ... 6 < 7 < 8 < 9]"""
363363

364364
assert repr(s) == exp
365365

0 commit comments

Comments
 (0)