Skip to content

Commit 3d89931

Browse files
authored
DEPR: Remove Int/Uint/Float64Index from pandas/tests/frame (#50825)
1 parent 0f2d5a5 commit 3d89931

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pandas/tests/frame/methods/test_astype.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
CategoricalDtype,
1212
DataFrame,
1313
DatetimeTZDtype,
14+
Index,
1415
Interval,
1516
IntervalDtype,
1617
NaT,
@@ -22,7 +23,6 @@
2223
option_context,
2324
)
2425
import pandas._testing as tm
25-
from pandas.core.api import UInt64Index
2626

2727

2828
def _check_cast(df, v):
@@ -372,7 +372,7 @@ def test_astype_extension_dtypes_duplicate_col(self, dtype):
372372
)
373373
def test_astype_column_metadata(self, dtype):
374374
# GH#19920
375-
columns = UInt64Index([100, 200, 300], name="foo")
375+
columns = Index([100, 200, 300], dtype=np.uint64, name="foo")
376376
df = DataFrame(np.arange(15).reshape(5, 3), columns=columns)
377377
df = df.astype(dtype)
378378
tm.assert_index_equal(df.columns, columns)
@@ -441,7 +441,7 @@ def test_astype_to_datetime_unit(self, unit):
441441
arr = np.array([[1, 2, 3]], dtype=dtype)
442442
df = DataFrame(arr)
443443
ser = df.iloc[:, 0]
444-
idx = pd.Index(ser)
444+
idx = Index(ser)
445445
dta = ser._values
446446

447447
if unit in ["ns", "us", "ms", "s"]:
@@ -476,7 +476,7 @@ def test_astype_to_datetime_unit(self, unit):
476476
exp_dta = exp_ser._values
477477

478478
res_index = idx.astype(dtype)
479-
exp_index = pd.Index(exp_ser)
479+
exp_index = Index(exp_ser)
480480
assert exp_index.dtype == dtype
481481
tm.assert_index_equal(res_index, exp_index)
482482

@@ -504,7 +504,7 @@ def test_astype_to_timedelta_unit(self, unit):
504504
arr = np.array([[1, 2, 3]], dtype=dtype)
505505
df = DataFrame(arr)
506506
ser = df.iloc[:, 0]
507-
tdi = pd.Index(ser)
507+
tdi = Index(ser)
508508
tda = tdi._values
509509

510510
if unit in ["us", "ms", "s"]:

pandas/tests/frame/methods/test_truncate.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
from pandas import (
66
DataFrame,
77
DatetimeIndex,
8+
Index,
89
Series,
910
date_range,
1011
)
1112
import pandas._testing as tm
12-
from pandas.core.api import Int64Index
1313

1414

1515
class TestDataFrameTruncate:
@@ -108,13 +108,13 @@ def test_truncate_nonsortedindex_axis1(self):
108108
"before, after, indices",
109109
[(1, 2, [2, 1]), (None, 2, [2, 1, 0]), (1, None, [3, 2, 1])],
110110
)
111-
@pytest.mark.parametrize("klass", [Int64Index, DatetimeIndex])
111+
@pytest.mark.parametrize("dtyp", [*tm.ALL_REAL_NUMPY_DTYPES, "datetime64[ns]"])
112112
def test_truncate_decreasing_index(
113-
self, before, after, indices, klass, frame_or_series
113+
self, before, after, indices, dtyp, frame_or_series
114114
):
115115
# https://github.com/pandas-dev/pandas/issues/33756
116-
idx = klass([3, 2, 1, 0])
117-
if klass is DatetimeIndex:
116+
idx = Index([3, 2, 1, 0], dtype=dtyp)
117+
if isinstance(idx, DatetimeIndex):
118118
before = pd.Timestamp(before) if before is not None else None
119119
after = pd.Timestamp(after) if after is not None else None
120120
indices = [pd.Timestamp(i) for i in indices]

0 commit comments

Comments
 (0)