Skip to content

Commit 56b5979

Browse files
TST: Interchange implementation for timestamp[ns][pyarrow] (#57026)
* TST: Interchange implementation for timestamp[ns][pyarrow] * Check timestamp explicitly * Use pytest.importorskip --------- Co-authored-by: Marco Edward Gorelli <[email protected]>
1 parent 46163c5 commit 56b5979

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Diff for: pandas/tests/interchange/test_impl.py

+24
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,30 @@ def test_multi_chunk_pyarrow() -> None:
293293
pd.api.interchange.from_dataframe(table, allow_copy=False)
294294

295295

296+
def test_timestamp_ns_pyarrow():
297+
# GH 56712
298+
pytest.importorskip("pyarrow", "11.0.0")
299+
timestamp_args = {
300+
"year": 2000,
301+
"month": 1,
302+
"day": 1,
303+
"hour": 1,
304+
"minute": 1,
305+
"second": 1,
306+
}
307+
df = pd.Series(
308+
[datetime(**timestamp_args)],
309+
dtype="timestamp[ns][pyarrow]",
310+
name="col0",
311+
).to_frame()
312+
313+
dfi = df.__dataframe__()
314+
result = pd.api.interchange.from_dataframe(dfi)["col0"].item()
315+
316+
expected = pd.Timestamp(**timestamp_args)
317+
assert result == expected
318+
319+
296320
@pytest.mark.parametrize("tz", ["UTC", "US/Pacific"])
297321
def test_datetimetzdtype(tz, unit):
298322
# GH 54239

0 commit comments

Comments
 (0)