salesforce / Merlion

Merlion: A Machine Learning Framework for Time Series Intelligence
BSD 3-Clause "New" or "Revised" License
3.43k stars 302 forks source link

[BUG] nab.py error line 87: converting np.int64 #155

Open ravenrip opened 1 year ago

ravenrip commented 1 year ago

Describe the bug Following the Tutorial (A Gentle Introduction to Anomaly Detection in Merlion, I receive the following error: 84 df = df.drop_duplicates(subset="timestamp", keep="first") 85 logger.warning(f"Time series {csv} (index {i}) has timestamp duplicates. Kept first values.") ---> 87 all_dt = np.unique(np.diff(df["timestamp"])).astype(np.int64) 88 gcd_dt = all_dt[0] 89 for dt in all_dt[1:]:

TypeError: int() argument must be a string, a bytes-like object or a real number, not 'Timedelta'

To Reproduce Perform the first step in the tutorial on Anomaly Detection

Expected behavior Receive a train & test dataset

Screenshots N/A

Desktop (please complete the following information):

Additional context Fixed the issue by changing line 87 in nab.py FROM: all_dt = np.unique(np.diff(df["timestamp"])).astype(np.int64)

TO: all_dt = np.unique(np.diff(df["timestamp"]))

akramsalim commented 1 year ago

Hi, I'm facing the same issue and did change the line 87 in nab.py as you described. However, i still have the same issue. Did you do something else after change the line 87 in nab.py? I appreciate your answer.

rajab1691 commented 12 months ago

It's working, just restart the notebook and again import Merlion and run all the cell