Skip to content

TST: Test non-nanosecond datetimes in PyArrow Parquet dataframes #59393

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 10 commits into from
Aug 19, 2024
15 changes: 15 additions & 0 deletions pandas/tests/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,21 @@ def test_infer_string_large_string_type(self, tmp_path, pa):
# assert result["strings"].dtype == "string"
# FIXME: don't leave commented-out

def test_non_nanosecond_timestamps(self, temp_file):
# GH#49236
pa = pytest.importorskip("pyarrow", "11.0.0")
pq = pytest.importorskip("pyarrow.parquet")

arr = pa.array([datetime.datetime(1600, 1, 1)], type=pa.timestamp("us"))
table = pa.table([arr], names=["timestamp"])
pq.write_table(table, temp_file)
result = read_parquet(temp_file)
expected = pd.DataFrame(
data={"timestamp": [datetime.datetime(1600, 1, 1)]},
dtype="datetime64[us]",
)
tm.assert_frame_equal(result, expected)


class TestParquetFastParquet(Base):
@pytest.mark.xfail(reason="datetime_with_nat gets incorrect values")
Expand Down
Loading