Skip to content

Commit

Permalink
Retain minimum ms granularity.
Browse files Browse the repository at this point in the history
  • Loading branch information
aadyotb committed Sep 13, 2022
1 parent 8778865 commit 1ca2e70
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions merlion/utils/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,9 @@ def from_pd(cls, df: Union[pd.Series, pd.DataFrame, np.ndarray], check_times=Tru
df = df[~df.index.duplicated()]
if not df.index.is_monotonic_increasing:
df = df.sort_index()
if dt_index:
times = df.index.values.astype("datetime64[ms]").astype(np.int64)
df = df.reindex(pd.to_datetime(np.unique(times), unit="ms"), method="bfill")

elif not aligned and not dt_index and df.index.dtype not in ("int64", "float64"):
raise RuntimeError(
Expand Down

0 comments on commit 1ca2e70

Please sign in to comment.