diff --git a/pandas/tests/resample/test_resampler_grouper.py b/pandas/tests/resample/test_resampler_grouper.py index 0c8e303b4ac56..3ab57e137f1c1 100644 --- a/pandas/tests/resample/test_resampler_grouper.py +++ b/pandas/tests/resample/test_resampler_grouper.py @@ -15,7 +15,6 @@ Timestamp, ) import pandas._testing as tm -from pandas.core.api import Int64Index from pandas.core.indexes.datetimes import date_range test_frame = DataFrame( @@ -333,7 +332,7 @@ def test_consistency_with_window(): # consistent return values with window df = test_frame - expected = Int64Index([1, 2, 3], name="A") + expected = Index([1, 2, 3], name="A") result = df.groupby("A").resample("2s").mean() assert result.index.nlevels == 2 tm.assert_index_equal(result.index.levels[0], expected) diff --git a/pandas/tests/reshape/merge/test_merge.py b/pandas/tests/reshape/merge/test_merge.py index 35d10eafb5ba7..e52687e3cfbc2 100644 --- a/pandas/tests/reshape/merge/test_merge.py +++ b/pandas/tests/reshape/merge/test_merge.py @@ -20,6 +20,7 @@ CategoricalIndex, DataFrame, DatetimeIndex, + Index, IntervalIndex, MultiIndex, PeriodIndex, @@ -29,11 +30,6 @@ ) import pandas._testing as tm from pandas.api.types import CategoricalDtype as CDT -from pandas.core.api import ( - Float64Index, - Int64Index, - UInt64Index, -) from pandas.core.reshape.concat import concat from pandas.core.reshape.merge import ( MergeError, @@ -1324,8 +1320,13 @@ def test_merge_two_empty_df_no_division_error(self): ["2001-01-01", "2002-02-02", "2003-03-03", pd.NaT, pd.NaT, pd.NaT] ), ), - (Float64Index([1, 2, 3]), Float64Index([1, 2, 3, None, None, None])), - (Int64Index([1, 2, 3]), Float64Index([1, 2, 3, None, None, None])), + *[ + ( + Index([1, 2, 3], dtype=dtyp), + Index([1, 2, 3, None, None, None], dtype=np.float64), + ) + for dtyp in tm.ALL_REAL_NUMPY_DTYPES + ], ( IntervalIndex.from_tuples([(1, 2), (2, 3), (3, 4)]), IntervalIndex.from_tuples( @@ -2142,15 +2143,13 @@ def test_merge_on_indexes(self, left_df, right_df, how, sort, expected): @pytest.mark.parametrize( "index", - [ + [Index([1, 2], dtype=dtyp, name="index_col") for dtyp in tm.ALL_REAL_NUMPY_DTYPES] + + [ CategoricalIndex(["A", "B"], categories=["A", "B"], name="index_col"), - Float64Index([1.0, 2.0], name="index_col"), - Int64Index([1, 2], name="index_col"), - UInt64Index([1, 2], name="index_col"), RangeIndex(start=0, stop=2, name="index_col"), DatetimeIndex(["2018-01-01", "2018-01-02"], name="index_col"), ], - ids=lambda x: type(x).__name__, + ids=lambda x: f"{type(x).__name__}[{x.dtype}]", ) def test_merge_index_types(index): # gh-20777 @@ -2652,11 +2651,11 @@ def test_merge_duplicate_columns_with_suffix_causing_another_duplicate_raises(): def test_merge_string_float_column_result(): # GH 13353 - df1 = DataFrame([[1, 2], [3, 4]], columns=pd.Index(["a", 114.0])) + df1 = DataFrame([[1, 2], [3, 4]], columns=Index(["a", 114.0])) df2 = DataFrame([[9, 10], [11, 12]], columns=["x", "y"]) result = merge(df2, df1, how="inner", left_index=True, right_index=True) expected = DataFrame( - [[9, 10, 1, 2], [11, 12, 3, 4]], columns=pd.Index(["x", "y", "a", 114.0]) + [[9, 10, 1, 2], [11, 12, 3, 4]], columns=Index(["x", "y", "a", 114.0]) ) tm.assert_frame_equal(result, expected) @@ -2712,8 +2711,8 @@ def test_merge_outer_with_NaN(dtype): def test_merge_different_index_names(): # GH#45094 - left = DataFrame({"a": [1]}, index=pd.Index([1], name="c")) - right = DataFrame({"a": [1]}, index=pd.Index([1], name="d")) + left = DataFrame({"a": [1]}, index=Index([1], name="c")) + right = DataFrame({"a": [1]}, index=Index([1], name="d")) result = merge(left, right, left_on="c", right_on="d") expected = DataFrame({"a_x": [1], "a_y": 1}) tm.assert_frame_equal(result, expected)