diff --git a/pandas/tests/arithmetic/common.py b/pandas/tests/arithmetic/common.py index 386490623dc47..649ad562307c0 100644 --- a/pandas/tests/arithmetic/common.py +++ b/pandas/tests/arithmetic/common.py @@ -8,7 +8,7 @@ DataFrame, Index, Series, - array as pd_array, + array, ) import pandas._testing as tm from pandas.core.arrays import PandasArray @@ -60,7 +60,7 @@ def assert_invalid_comparison(left, right, box): # Not for tznaive-tzaware comparison # Note: not quite the same as how we do this for tm.box_expected - xbox = box if box not in [Index, pd_array] else np.array + xbox = box if box not in [Index, array] else np.array def xbox2(x): # Eventually we'd like this to be tighter, but for now we'll diff --git a/pandas/tests/frame/test_constructors.py b/pandas/tests/frame/test_constructors.py index 4342f1960f178..8da7af5c4d86e 100644 --- a/pandas/tests/frame/test_constructors.py +++ b/pandas/tests/frame/test_constructors.py @@ -1216,14 +1216,14 @@ def __len__(self, n): def test_constructor_stdlib_array(self): # GH 4297 # support Array - import array + from array import array as stdlib_array - result = DataFrame({"A": array.array("i", range(10))}) + result = DataFrame({"A": stdlib_array("i", range(10))}) expected = DataFrame({"A": list(range(10))}) tm.assert_frame_equal(result, expected, check_dtype=False) expected = DataFrame([list(range(10)), list(range(10))]) - result = DataFrame([array.array("i", range(10)), array.array("i", range(10))]) + result = DataFrame([stdlib_array("i", range(10)), stdlib_array("i", range(10))]) tm.assert_frame_equal(result, expected, check_dtype=False) def test_constructor_range(self): diff --git a/pandas/tests/indexing/test_iloc.py b/pandas/tests/indexing/test_iloc.py index ad5f54174952d..c28674380a839 100644 --- a/pandas/tests/indexing/test_iloc.py +++ b/pandas/tests/indexing/test_iloc.py @@ -17,7 +17,7 @@ Index, NaT, Series, - array as pd_array, + array, concat, date_range, isna, @@ -93,11 +93,11 @@ def test_iloc_setitem_fullcol_categorical(self, indexer, key): else: assert cat[0] != "gamma" - @pytest.mark.parametrize("box", [pd_array, Series]) + @pytest.mark.parametrize("box", [array, Series]) def test_iloc_setitem_ea_inplace(self, frame_or_series, box): # GH#38952 Case with not setting a full column # IntegerArray without NAs - arr = pd_array([1, 2, 3, 4]) + arr = array([1, 2, 3, 4]) obj = frame_or_series(arr.to_numpy("i8")) values = obj.values diff --git a/pandas/tests/series/methods/test_view.py b/pandas/tests/series/methods/test_view.py index f0069cdb9b79c..818023c01e4e7 100644 --- a/pandas/tests/series/methods/test_view.py +++ b/pandas/tests/series/methods/test_view.py @@ -4,7 +4,7 @@ from pandas import ( Index, Series, - array as pd_array, + array, date_range, ) import pandas._testing as tm @@ -31,7 +31,7 @@ def test_view_tz(self): @pytest.mark.parametrize( "second", ["m8[ns]", "M8[ns]", "M8[ns, US/Central]", "period[D]"] ) - @pytest.mark.parametrize("box", [Series, Index, pd_array]) + @pytest.mark.parametrize("box", [Series, Index, array]) def test_view_between_datetimelike(self, first, second, box): dti = date_range("2016-01-01", periods=3) diff --git a/scripts/check_for_inconsistent_pandas_namespace.py b/scripts/check_for_inconsistent_pandas_namespace.py index 87070e819b4a0..c84a92324f976 100644 --- a/scripts/check_for_inconsistent_pandas_namespace.py +++ b/scripts/check_for_inconsistent_pandas_namespace.py @@ -29,7 +29,6 @@ ERROR_MESSAGE = "Found both `pd.{name}` and `{name}` in {path}" EXCLUDE = { - "array", # `import array` and `pd.array` should both be allowed "eval", # built-in, different from `pd.eval` "np", # pd.np is deprecated but still tested }