Merlion icon indicating copy to clipboard operation
Merlion copied to clipboard

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

Open ravenrip opened this issue 2 years ago • 2 comments

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):

  • OS: Windows 11
  • Merlion Version: Main code branch

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"]))

ravenrip avatar May 19 '23 13:05 ravenrip

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.

akramsalim avatar May 24 '23 07:05 akramsalim

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

rajab1691 avatar Nov 30 '23 16:11 rajab1691