Skip to content

Commit

Permalink
Handle dtype as dt.datetime or dt.date
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Oct 6, 2023
1 parent c236871 commit d97ba92
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion holonote/annotate/table.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import datetime as dt
from typing import TYPE_CHECKING, Any

import pandas as pd
Expand Down Expand Up @@ -244,7 +245,7 @@ def _empty_expanded_region_df(self, *, spec: SpecDict, dims: list[str] | None) -
columns, types = [], []
for dim in dims:
region = spec[dim]["region"]
dtype = spec[dim]["type"]()
dtype = pd.NaT if isinstance(t := spec[dim]["type"], dt.date) else t()
if region == "range":
columns.extend([f"start[{dim}]", f"end[{dim}]"])
types.extend([dtype, dtype])
Expand Down

0 comments on commit d97ba92

Please sign in to comment.