Skip to content
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
16 changes: 12 additions & 4 deletions python/pyarrow/tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3095,8 +3095,6 @@ def test_category(self):

arrays = {
'cat_strings': pd.Categorical(v1 * repeats),
'cat_strings_with_na': pd.Categorical(v1 * repeats,
categories=['foo', 'bar']),
'cat_ints': pd.Categorical(v2 * repeats),
'cat_binary': pd.Categorical(v3 * repeats),
'cat_strings_ordered': pd.Categorical(
Expand All @@ -3121,13 +3119,23 @@ def _check(v):
tm.assert_series_equal(pd.Series(result), pd.Series(v))

arrays = [
pd.Categorical(['a', 'b', 'c'], categories=['a', 'b']),
pd.Categorical(['a', 'b', 'c'], categories=['a', 'b'],
pd.Categorical(['a', 'b', None], categories=['a', 'b']),
pd.Categorical(['a', 'b', None], categories=['a', 'b'],
ordered=True)
]
for arr in arrays:
_check(arr)

def test_category_construction_deprecation(self):
# GH-49255
if Version(pd.__version__) < Version("3.0.0"):
pytest.skip("out-of-category deprecation added in pandas 3.0")
with pytest.warns(
DeprecationWarning,
match="Constructing a Categorical with a dtype and "
"values containing non-null entries"):
pd.Categorical(['a', 'b', 'c'], categories=['a', 'b'])

def test_empty_category(self):
# ARROW-2443
df = pd.DataFrame({'cat': pd.Categorical([])})
Expand Down
2 changes: 2 additions & 0 deletions python/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ filterwarnings =
error:The SparseDataFrame:FutureWarning
# https://github.com/apache/arrow/issues/38239
ignore:Setting custom ClientSession:DeprecationWarning
# https://github.com/apache/arrow/issues/49255
error:Constructing a Categorical with a dtype and values containing non-null entries:DeprecationWarning
# Get a debug traceback when a test takes a really long time
faulthandler_timeout = 300

Expand Down
Loading