From c261db965c6c4c1ceaa6a5abed975904ee78595d Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Sun, 28 Nov 2021 18:05:38 -0800 Subject: [PATCH] COMPAT: Fix FutureWarning with pyarrow 6.0.0 Judging from the comment and https://github.com/apache/parquet-format/blob/master/CHANGES.md, the correct version should be 2.6.0 since that's when https://issues.apache.org/jira/browse/PARQUET-1387 was added. This was showing up as a warning on fastparquet's pandas-dev CI. --- pandas/tests/io/test_parquet.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pandas/tests/io/test_parquet.py b/pandas/tests/io/test_parquet.py index 270cb402483bf..c91356bad12f7 100644 --- a/pandas/tests/io/test_parquet.py +++ b/pandas/tests/io/test_parquet.py @@ -17,6 +17,7 @@ from pandas.compat.pyarrow import ( pa_version_under2p0, pa_version_under5p0, + pa_version_under6p0, ) import pandas.util._test_decorators as td @@ -902,10 +903,15 @@ def test_additional_extension_types(self, pa): check_round_trip(df, pa) def test_timestamp_nanoseconds(self, pa): - # with version 2.0, pyarrow defaults to writing the nanoseconds, so + # with version 2.6, pyarrow defaults to writing the nanoseconds, so # this should work without error + # Note in previous pyarrows(<6.0.0), only the pseudo-version 2.0 was available + if not pa_version_under6p0: + ver = "2.6" + else: + ver = "2.0" df = pd.DataFrame({"a": pd.date_range("2017-01-01", freq="1n", periods=10)}) - check_round_trip(df, pa, write_kwargs={"version": "2.0"}) + check_round_trip(df, pa, write_kwargs={"version": ver}) def test_timezone_aware_index(self, pa, timezone_aware_date_list): if not pa_version_under2p0: