Skip to content

Commit

Permalink
GH-39437: [CI][Python] Update pandas tests failing on pandas nightly …
Browse files Browse the repository at this point in the history
…CI build (#39498)

Update version checks and assertions of pyarrow array equality for pandas failing tests on the CI: [test-conda-python-3.10-pandas-nightly](https://github.com/ursacomputing/crossbow/actions/runs/7391976015/job/20109720695)

* Closes: #39437

Lead-authored-by: AlenkaF <[email protected]>
Co-authored-by: Alenka Frim <[email protected]>
Co-authored-by: Joris Van den Bossche <[email protected]>
Signed-off-by: Joris Van den Bossche <[email protected]>
  • Loading branch information
AlenkaF and jorisvandenbossche authored Jan 8, 2024
1 parent 20bcf0f commit 48f704e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
10 changes: 7 additions & 3 deletions python/pyarrow/tests/parquet/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ def test_backwards_compatible_index_multi_level_some_named(datadir):

@pytest.mark.pandas
def test_backwards_compatible_column_metadata_handling(datadir):
if Version("2.2.0") <= Version(pd.__version__):
# TODO: regression in pandas
# https://github.com/pandas-dev/pandas/issues/56775
pytest.skip("Regression in pandas 2.2.0")
expected = pd.DataFrame(
{'a': [1, 2, 3], 'b': [.1, .2, .3],
'c': pd.date_range("2017-01-01", periods=3, tz='Europe/Brussels')})
Expand Down Expand Up @@ -504,9 +508,9 @@ def test_categories_with_string_pyarrow_dtype(tempdir):
df2 = df2.astype("category")

# categories should be converted to pa.Array
assert pa.array(df1["x"]) == pa.array(df2["x"])
assert pa.array(df1["x"].cat.categories.values) == pa.array(
df2["x"].cat.categories.values)
assert pa.array(df1["x"]).to_pylist() == pa.array(df2["x"]).to_pylist()
assert pa.array(df1["x"].cat.categories.values).to_pylist() == pa.array(
df2["x"].cat.categories.values).to_pylist()

path = str(tempdir / 'cat.parquet')
pq.write_table(pa.table(df1), path)
Expand Down
16 changes: 14 additions & 2 deletions python/pyarrow/tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ def test_rangeindex_doesnt_warn(self):

with warnings.catch_warnings():
warnings.simplefilter(action="error")
# make_block deprecation in pandas, still under discussion
# https://github.com/pandas-dev/pandas/pull/56422
# https://github.com/pandas-dev/pandas/issues/40226
warnings.filterwarnings(
"ignore", "make_block is deprecated", DeprecationWarning
)
_check_pandas_roundtrip(df, preserve_index=True)

def test_multiindex_columns(self):
Expand Down Expand Up @@ -311,6 +317,12 @@ def test_multiindex_doesnt_warn(self):

with warnings.catch_warnings():
warnings.simplefilter(action="error")
# make_block deprecation in pandas, still under discussion
# https://github.com/pandas-dev/pandas/pull/56422
# https://github.com/pandas-dev/pandas/issues/40226
warnings.filterwarnings(
"ignore", "make_block is deprecated", DeprecationWarning
)
_check_pandas_roundtrip(df, preserve_index=True)

def test_integer_index_column(self):
Expand Down Expand Up @@ -465,7 +477,7 @@ def test_mixed_column_names(self):
preserve_index=True)

def test_binary_column_name(self):
if Version("2.0.0") <= Version(pd.__version__) < Version("2.2.0"):
if Version("2.0.0") <= Version(pd.__version__) < Version("2.3.0"):
# TODO: regression in pandas, hopefully fixed in next version
# https://issues.apache.org/jira/browse/ARROW-18394
# https://github.com/pandas-dev/pandas/issues/50127
Expand Down Expand Up @@ -3095,7 +3107,7 @@ def _fully_loaded_dataframe_example():

@pytest.mark.parametrize('columns', ([b'foo'], ['foo']))
def test_roundtrip_with_bytes_unicode(columns):
if Version("2.0.0") <= Version(pd.__version__) < Version("2.2.0"):
if Version("2.0.0") <= Version(pd.__version__) < Version("2.3.0"):
# TODO: regression in pandas, hopefully fixed in next version
# https://issues.apache.org/jira/browse/ARROW-18394
# https://github.com/pandas-dev/pandas/issues/50127
Expand Down

0 comments on commit 48f704e

Please sign in to comment.