Skip to content

Commit

Permalink
fix(pandas): map date type to datetime64[s] (#8667)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist authored Mar 17, 2024
1 parent fac85f0 commit 6bd965e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ibis/formats/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def to_ibis(cls, typ, nullable=True):
def from_ibis(cls, dtype):
if dtype.is_timestamp() and dtype.timezone:
return pdt.DatetimeTZDtype("ns", dtype.timezone)
elif dtype.is_date():
return np.dtype("M8[s]")
elif dtype.is_interval():
return np.dtype(f"timedelta64[{dtype.unit.short}]")
else:
Expand Down
2 changes: 1 addition & 1 deletion ibis/formats/tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
(dt.float32, np.dtype("float32")),
(dt.float64, np.dtype("float64")),
(dt.boolean, np.dtype("bool")),
(dt.date, np.dtype("datetime64[D]")),
(dt.date, np.dtype("datetime64[s]")),
(dt.time, np.dtype("timedelta64[ns]")),
(dt.timestamp, np.dtype("datetime64[ns]")),
(dt.Interval("s"), np.dtype("timedelta64[s]")),
Expand Down

0 comments on commit 6bd965e

Please sign in to comment.