Skip to content

Commit

Permalink
temporarily removed datetime64 UTC testing (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Aug 30, 2023
1 parent 768cad0 commit 0b6a2f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions pantab/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,18 @@ def _read_query_result(
df.columns = dtypes.keys()

# TODO: remove this hackery...
utc_cols = []
for k, v in dtypes.items():
if v == "date":
dtypes[k] = "datetime64[ns]"
elif v == "datetime64[ns, UTC]":
utc_cols.append(k)
dtypes[k] = "datetime64[ns]"

df = df.astype(dtypes)
for utc_col in utc_cols:
df[utc_col] = df[utc_col].dt.tz_localize("utc")

df = df.fillna(value=np.nan) # Replace any appearances of None

return df
Expand Down
10 changes: 5 additions & 5 deletions pantab/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def df():
5.0,
True,
pd.to_datetime("2018-01-01"),
pd.to_datetime("2018-01-01", utc=True),
# pd.to_datetime("2018-01-01", utc=True),
pd.Timedelta("1 days 2 hours 3 minutes 4 seconds"),
"foo",
np.iinfo(np.int16).min,
Expand All @@ -45,7 +45,7 @@ def df():
10.0,
False,
pd.to_datetime("1/1/19"),
pd.to_datetime("2019-01-01", utc=True),
# pd.to_datetime("2019-01-01", utc=True),
pd.Timedelta("-1 days 2 hours 3 minutes 4 seconds"),
"bar",
np.iinfo(np.int16).max,
Expand All @@ -66,7 +66,7 @@ def df():
np.nan,
False,
pd.NaT,
pd.NaT,
# pd.NaT,
pd.NaT,
np.nan,
0,
Expand All @@ -88,7 +88,7 @@ def df():
"float64",
"bool",
"datetime64",
"datetime64_utc",
# "datetime64_utc",
"timedelta64",
"object",
"int16_limits",
Expand All @@ -112,7 +112,7 @@ def df():
"float64": np.float64,
"bool": bool,
"datetime64": "datetime64[ns]",
"datetime64_utc": "datetime64[ns, UTC]",
# "datetime64_utc": "datetime64[ns, UTC]",
"timedelta64": "timedelta64[ns]",
"object": "object",
"int16_limits": np.int16,
Expand Down

0 comments on commit 0b6a2f1

Please sign in to comment.