Skip to content

Commit 24a3211

Browse files
committed
feat: ensure datetime index is correctly converted to 'datetime64[ns]' in convert_index_to_timestamps function
1 parent a64b2f7 commit 24a3211

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

pydsm/analysis/postpro.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
def convert_index_to_timestamps(df):
3535
if isinstance(df.index, pd.core.indexes.datetimes.DatetimeIndex):
36+
if df.index.dtype != "datetime64[ns]":
37+
df.index = df.index.astype("datetime64[ns]")
3638
return
3739
df.index = df.index.astype("datetime64[ns]")
3840
df.index.freq = pd.infer_freq(df.index) # if possible

0 commit comments

Comments
 (0)