Skip to content

Commit 9573e16

Browse files
Terji PetersenTerji Petersen
Terji Petersen
authored and
Terji Petersen
committed
32-bit stuff III
1 parent de9ef93 commit 9573e16

15 files changed

+25
-27
lines changed

pandas/tests/frame/methods/test_value_counts.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_data_frame_value_counts_empty():
8888
df_no_cols = pd.DataFrame()
8989

9090
result = df_no_cols.value_counts()
91-
expected = pd.Series([], dtype=np.int64, index=np.array([], dtype=np.int_))
91+
expected = pd.Series([], dtype=np.int64, index=np.array([], dtype=np.intp))
9292

9393
tm.assert_series_equal(result, expected)
9494

@@ -97,7 +97,7 @@ def test_data_frame_value_counts_empty_normalize():
9797
df_no_cols = pd.DataFrame()
9898

9999
result = df_no_cols.value_counts(normalize=True)
100-
expected = pd.Series([], dtype=np.float64, index=np.array([], dtype=np.int_))
100+
expected = pd.Series([], dtype=np.float64, index=np.array([], dtype=np.intp))
101101

102102
tm.assert_series_equal(result, expected)
103103

pandas/tests/groupby/aggregate/test_cython.py

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

pandas/tests/groupby/test_min_max.py

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

114114
# Note: in converting to float64, the iNaT + 1 maps to iNaT, i.e. is lossy
115115
expected = Series({1: np.nan, 2: np.nan, 3: iNaT + 1})
116-
expected.index = expected.index.astype(np.intp)
116+
expected.index = expected.index.astype(np.int_)
117117
tm.assert_series_equal(result, expected, check_exact=True)
118118

119119

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/indexes/test_index_new.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def test_constructor_int_dtype_nan_raises(self, dtype):
283283
)
284284
def test_constructor_dtypes_to_int64(self, vals):
285285
index = Index(vals, dtype=int)
286-
assert isinstance(index, NumericIndex) and index.dtype == np.intp
286+
assert isinstance(index, NumericIndex) and index.dtype == np.int_
287287

288288
@pytest.mark.parametrize(
289289
"vals",

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)):
@@ -1212,7 +1212,7 @@ def test_loc_setitem_empty_append_raises(self):
12121212
df = DataFrame(columns=["x", "y"])
12131213
df.index = df.index.astype(np.int64)
12141214
msg = (
1215-
rf"None of \[NumericIndex\(\[0, 1\], dtype='{np.intp().dtype}'\)\] "
1215+
rf"None of \[NumericIndex\(\[0, 1\], dtype='{np.int_().dtype}'\)\] "
12161216
r"are in the \[index\]"
12171217
)
12181218
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 == "intp"
358+
assert df["key_0"].dtype == "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/reshape/test_pivot.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -2052,9 +2052,7 @@ def __init__(self, *args, **kwargs) -> None:
20522052
msg = "The following operation may generate"
20532053
with tm.assert_produces_warning(PerformanceWarning, match=msg):
20542054
with pytest.raises(Exception, match="Don't compute final result."):
2055-
df.pivot_table(
2056-
index="ind1", columns="ind2", values="count", aggfunc="count"
2057-
)
2055+
df.pivot_table(index="ind1", columns="ind2", values="count", aggfunc="count")
20582056

20592057
def test_pivot_table_aggfunc_dropna(self, dropna):
20602058
# GH 22159

pandas/tests/series/test_constructors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ def test_construction_interval(self, interval_constructor):
12051205
# construction from interval & array of intervals
12061206
intervals = interval_constructor.from_breaks(np.arange(3), closed="right")
12071207
result = Series(intervals)
1208-
assert result.dtype == f"interval[{np.intp().dtype}, right]"
1208+
assert result.dtype == f"interval[{np.int_().dtype}, right]"
12091209
tm.assert_index_equal(Index(result.values), Index(intervals))
12101210

12111211
@pytest.mark.parametrize(

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

pandas/tests/window/test_groupby.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -920,8 +920,8 @@ def test_nan_and_zero_endpoints(self):
920920
name="adl2",
921921
index=MultiIndex.from_arrays(
922922
[
923-
Index([0] * 999 + [1], dtype=np.intp, name="index"),
924-
Index([0] * 999 + [1], dtype=np.intp, name="index"),
923+
Index([0] * 999 + [1], dtype=np.int_, name="index"),
924+
Index([0] * 999 + [1], dtype=np.int_, name="index"),
925925
],
926926
),
927927
)

pandas/tests/window/test_pairwise.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_flex_binary_frame(method, frame):
9999
exp = DataFrame(
100100
{k: getattr(frame[k].rolling(window=10), method)(frame2[k]) for k in frame}
101101
)
102-
exp.columns = exp.columns.astype(np.intp)
102+
exp.columns = exp.columns.astype(np.int_)
103103
tm.assert_frame_equal(res3, exp)
104104

105105

0 commit comments

Comments
 (0)