Hi, there! As part of my review for your JOSS submission, I've been running through your documentation. I'm testing your package from a clean conda env using the conda-forge installation instructions. I tried testing the resample_time() function in both of the examples provided in the "Rediscretizing Trajectories" documentation and got the following errors:
>>> from traja import generate, resample_time
>>> resampled = traja.resample_time(df, step_time='50L') # 50 milliseconds
>>> resampled.head()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-74-2b8f8cf07c98> in <module>
1 from traja import generate, resample_time
----> 2 resampled = traja.resample_time(df, step_time='50L') # 50 milliseconds
3 resampled.head()
/anaconda3/envs/traja_review/lib/python3.9/site-packages/traja/trajectory.py in resample_time(trj, step_time, new_fps)
708 _trj.reset_index(inplace=True)
709 # Reset time_col to float dtype
--> 710 _trj[time_col] = pd.to_timedelta(_trj[time_col]).dt.total_seconds()
711 else:
712 raise NotImplementedError(
/anaconda3/envs/traja_review/lib/python3.9/site-packages/pandas/core/tools/timedeltas.py in to_timedelta(arg, unit, errors)
112 return arg
113 elif isinstance(arg, ABCSeries):
--> 114 values = _convert_listlike(arg._values, unit=unit, errors=errors)
115 return arg._constructor(values, index=arg.index, name=arg.name)
116 elif isinstance(arg, ABCIndexClass):
/anaconda3/envs/traja_review/lib/python3.9/site-packages/pandas/core/tools/timedeltas.py in _convert_listlike(arg, unit, errors, name)
159
160 try:
--> 161 value = sequence_to_td64ns(arg, unit=unit, errors=errors, copy=False)[0]
162 except ValueError:
163 if errors == "ignore":
/anaconda3/envs/traja_review/lib/python3.9/site-packages/pandas/core/arrays/timedeltas.py in sequence_to_td64ns(data, copy, unit, errors)
985 else:
986 # This includes datetime64-dtype, see GH#23539, GH#29794
--> 987 raise TypeError(f"dtype {data.dtype} cannot be converted to timedelta64[ns]")
988
989 data = np.array(data, copy=copy)
TypeError: dtype datetime64[ns] cannot be converted to timedelta64[ns]
>>> import traja
>>> df = traja.generate(n=1000)
>>> resampled = traja.resample_time(df, "50L")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-76-25ba5185b819> in <module>
----> 1 resampled = traja.resample_time(df, "50L")
/anaconda3/envs/traja_review/lib/python3.9/site-packages/traja/trajectory.py in resample_time(trj, step_time, new_fps)
708 _trj.reset_index(inplace=True)
709 # Reset time_col to float dtype
--> 710 _trj[time_col] = pd.to_timedelta(_trj[time_col]).dt.total_seconds()
711 else:
712 raise NotImplementedError(
/anaconda3/envs/traja_review/lib/python3.9/site-packages/pandas/core/tools/timedeltas.py in to_timedelta(arg, unit, errors)
112 return arg
113 elif isinstance(arg, ABCSeries):
--> 114 values = _convert_listlike(arg._values, unit=unit, errors=errors)
115 return arg._constructor(values, index=arg.index, name=arg.name)
116 elif isinstance(arg, ABCIndexClass):
/anaconda3/envs/traja_review/lib/python3.9/site-packages/pandas/core/tools/timedeltas.py in _convert_listlike(arg, unit, errors, name)
159
160 try:
--> 161 value = sequence_to_td64ns(arg, unit=unit, errors=errors, copy=False)[0]
162 except ValueError:
163 if errors == "ignore":
/anaconda3/envs/traja_review/lib/python3.9/site-packages/pandas/core/arrays/timedeltas.py in sequence_to_td64ns(data, copy, unit, errors)
985 else:
986 # This includes datetime64-dtype, see GH#23539, GH#29794
--> 987 raise TypeError(f"dtype {data.dtype} cannot be converted to timedelta64[ns]")
988
989 data = np.array(data, copy=copy)
TypeError: dtype datetime64[ns] cannot be converted to timedelta64[ns]
Hi, there! As part of my review for your JOSS submission, I've been running through your documentation. I'm testing your package from a clean conda env using the conda-forge installation instructions. I tried testing the
resample_time()
function in both of the examples provided in the "Rediscretizing Trajectories" documentation and got the following errors:Thanks again!