Skip to content

Commit

Permalink
DEPR: Remove Int/Uint/Float64Index from pandas/tests/frame (#50825)
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 authored Jan 18, 2023
1 parent 0f2d5a5 commit 3d89931
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions pandas/tests/frame/methods/test_astype.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
CategoricalDtype,
DataFrame,
DatetimeTZDtype,
Index,
Interval,
IntervalDtype,
NaT,
Expand All @@ -22,7 +23,6 @@
option_context,
)
import pandas._testing as tm
from pandas.core.api import UInt64Index


def _check_cast(df, v):
Expand Down Expand Up @@ -372,7 +372,7 @@ def test_astype_extension_dtypes_duplicate_col(self, dtype):
)
def test_astype_column_metadata(self, dtype):
# GH#19920
columns = UInt64Index([100, 200, 300], name="foo")
columns = Index([100, 200, 300], dtype=np.uint64, name="foo")
df = DataFrame(np.arange(15).reshape(5, 3), columns=columns)
df = df.astype(dtype)
tm.assert_index_equal(df.columns, columns)
Expand Down Expand Up @@ -441,7 +441,7 @@ def test_astype_to_datetime_unit(self, unit):
arr = np.array([[1, 2, 3]], dtype=dtype)
df = DataFrame(arr)
ser = df.iloc[:, 0]
idx = pd.Index(ser)
idx = Index(ser)
dta = ser._values

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

res_index = idx.astype(dtype)
exp_index = pd.Index(exp_ser)
exp_index = Index(exp_ser)
assert exp_index.dtype == dtype
tm.assert_index_equal(res_index, exp_index)

Expand Down Expand Up @@ -504,7 +504,7 @@ def test_astype_to_timedelta_unit(self, unit):
arr = np.array([[1, 2, 3]], dtype=dtype)
df = DataFrame(arr)
ser = df.iloc[:, 0]
tdi = pd.Index(ser)
tdi = Index(ser)
tda = tdi._values

if unit in ["us", "ms", "s"]:
Expand Down
10 changes: 5 additions & 5 deletions pandas/tests/frame/methods/test_truncate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from pandas import (
DataFrame,
DatetimeIndex,
Index,
Series,
date_range,
)
import pandas._testing as tm
from pandas.core.api import Int64Index


class TestDataFrameTruncate:
Expand Down Expand Up @@ -108,13 +108,13 @@ def test_truncate_nonsortedindex_axis1(self):
"before, after, indices",
[(1, 2, [2, 1]), (None, 2, [2, 1, 0]), (1, None, [3, 2, 1])],
)
@pytest.mark.parametrize("klass", [Int64Index, DatetimeIndex])
@pytest.mark.parametrize("dtyp", [*tm.ALL_REAL_NUMPY_DTYPES, "datetime64[ns]"])
def test_truncate_decreasing_index(
self, before, after, indices, klass, frame_or_series
self, before, after, indices, dtyp, frame_or_series
):
# https://github.com/pandas-dev/pandas/issues/33756
idx = klass([3, 2, 1, 0])
if klass is DatetimeIndex:
idx = Index([3, 2, 1, 0], dtype=dtyp)
if isinstance(idx, DatetimeIndex):
before = pd.Timestamp(before) if before is not None else None
after = pd.Timestamp(after) if after is not None else None
indices = [pd.Timestamp(i) for i in indices]
Expand Down

0 comments on commit 3d89931

Please sign in to comment.