diff --git a/pandas/tests/indexes/ranges/test_range.py b/pandas/tests/indexes/ranges/test_range.py index b77289d5aadcd8..e534147c891d2a 100644 --- a/pandas/tests/indexes/ranges/test_range.py +++ b/pandas/tests/indexes/ranges/test_range.py @@ -473,17 +473,17 @@ def test_slice_specialised(self, simple_index): # positive slice values index_slice = index[7:10:2] - expected = Index(np.array([14, 18]), name="foo") + expected = Index([14, 18], name="foo") tm.assert_index_equal(index_slice, expected, exact="equiv") # negative slice values index_slice = index[-1:-5:-2] - expected = Index(np.array([18, 14]), name="foo") + expected = Index([18, 14], name="foo") tm.assert_index_equal(index_slice, expected, exact="equiv") # stop overshoot index_slice = index[2:100:4] - expected = Index(np.array([4, 12]), name="foo") + expected = Index([4, 12], name="foo") tm.assert_index_equal(index_slice, expected, exact="equiv") # reverse @@ -492,7 +492,7 @@ def test_slice_specialised(self, simple_index): tm.assert_index_equal(index_slice, expected, exact="equiv") index_slice = index[-8::-1] - expected = Index(np.array([4, 2, 0]), name="foo") + expected = Index([4, 2, 0], name="foo") tm.assert_index_equal(index_slice, expected, exact="equiv") index_slice = index[-40::-1] diff --git a/pandas/tests/indexing/test_indexing.py b/pandas/tests/indexing/test_indexing.py index b3e59da4b01306..0149b498a8e95c 100644 --- a/pandas/tests/indexing/test_indexing.py +++ b/pandas/tests/indexing/test_indexing.py @@ -41,7 +41,7 @@ def test_setitem_ndarray_1d(self): # GH5508 # len of indexer vs length of the 1d ndarray - df = DataFrame(index=Index(np.arange(1, 11))) + df = DataFrame(index=Index(np.arange(1, 11), dtype=np.int64)) df["foo"] = np.zeros(10, dtype=np.float64) df["bar"] = np.zeros(10, dtype=complex) diff --git a/pandas/tests/io/formats/test_format.py b/pandas/tests/io/formats/test_format.py index 640c686bb56ca3..f1fa4b57ebdfaf 100644 --- a/pandas/tests/io/formats/test_format.py +++ b/pandas/tests/io/formats/test_format.py @@ -1335,7 +1335,6 @@ def test_to_string(self): # big mixed biggie = DataFrame( {"A": np.random.randn(200), "B": tm.makeStringIndex(200)}, - index=np.arange(200), ) biggie.loc[:20, "A"] = np.nan diff --git a/pandas/tests/io/json/test_pandas.py b/pandas/tests/io/json/test_pandas.py index 2f3fc4d0fcba8d..223c815c914986 100644 --- a/pandas/tests/io/json/test_pandas.py +++ b/pandas/tests/io/json/test_pandas.py @@ -395,7 +395,7 @@ def test_frame_mixedtype_orient(self): # GH10289 left = read_json(inp, orient=orient, convert_axes=False) tm.assert_frame_equal(left, right) - right.index = np.arange(len(df)) + right.index = pd.RangeIndex(len(df)) inp = df.to_json(orient="records") left = read_json(inp, orient="records", convert_axes=False) tm.assert_frame_equal(left, right)