Skip to content

Commit

Permalink
Fix failing nightly test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlenkaF committed Jan 12, 2023
1 parent e937b4c commit 1b5f248
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions python/pyarrow/tests/interchange/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,21 @@ def test_roundtrip_pandas_boolean():
@pytest.mark.pandas
@pytest.mark.parametrize("unit", ['s', 'ms', 'us', 'ns'])
def test_roundtrip_pandas_datetime(unit):
# pandas < 2.0 always creates datetime64 in "ns"
# resolution, timezones are not yet supported in pandas

if Version(pd.__version__) < Version("1.5.0"):
pytest.skip("__dataframe__ added to pandas in 1.5.0")
from datetime import datetime as dt

# timezones not included as they are not yet supported in
# the pandas implementation
dt_arr = [dt(2007, 7, 13), dt(2007, 7, 14), dt(2007, 7, 15)]
table = pa.table({"a": pa.array(dt_arr, type=pa.timestamp(unit))})
expected = pa.table({"a": pa.array(dt_arr, type=pa.timestamp('ns'))})

if Version(pd.__version__) >= Version("2.0"):
expected = table
else:
# pandas < 2.0 always creates datetime64 in "ns"
# resolution
expected = pa.table({"a": pa.array(dt_arr, type=pa.timestamp('ns'))})

from pandas.api.interchange import (
from_dataframe as pandas_from_dataframe
Expand Down

0 comments on commit 1b5f248

Please sign in to comment.