Skip to content

Remove pd_array from tests #40267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/tests/arithmetic/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
DataFrame,
Index,
Series,
array as pd_array,
array,
)
import pandas._testing as tm
from pandas.core.arrays import PandasArray
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/indexing/test_iloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Index,
NaT,
Series,
array as pd_array,
array,
concat,
date_range,
isna,
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/series/methods/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pandas import (
Index,
Series,
array as pd_array,
array,
date_range,
)
import pandas._testing as tm
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion scripts/check_for_inconsistent_pandas_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down