normal-computing / posteriors

Uncertainty quantification with PyTorch
https://normal-computing.github.io/posteriors/
Apache License 2.0
282 stars 12 forks source link

ValueError arises in 'posteriors Extended Kalman filter for Premier League football' tutorial + simple fix #70

Closed entropich3atdeath closed 2 months ago

entropich3atdeath commented 2 months ago

The following ValueError arises in the EKF tutorial - ValueError: Cannot convert from timedelta64[ns] to timedelta64[D]. Supported resolutions are 's', 'ms', 'us', 'ns'.

This is due to the following line in the code to download the data - (data["Timestamp"] - origin_date).astype("timedelta64[D]").astype(int)

This is fixed by instead using (data["Timestamp"] - origin_date).dt.days.astype(int)

Solution obtained from - https://stackoverflow.com/questions/76363921/how-to-fix-pandas-v2-valueerror-cannot-convert-from-timedelta64ns-to-timedel

SamDuffield commented 2 months ago

Looks good! 🤩 Wanna do a PR? @entropich3atdeath

You can find our contributing guidelines here https://normal-computing.github.io/posteriors/contributing/

SamDuffield commented 2 months ago

Fixed in #72