Compatibility with Pandas >= 2.0
Hello,
While working with neuralforecast 1.6.4 and pandas > 2.0 I found the error when calling neuralforecast.utils.augment_calendar_df :
'DatetimeIndex' object has no attribute 'week'.
This is because this functions calls:
https://github.com/Nixtla/neuralforecast/blob/4e9b721bbbcfb1b870c9fd5ab039c9ea9cb74c10/neuralforecast/utils.py#L360
Which is using index.week, but DatetimeIndex.week has been deprecated since pandas 1.1.0, to solve this you should replace it by:
return (index.isocalendar().week - 1) / 52.0 - 0.5
Thanks, good point. I think it should be index.dt.isocalendar().week, i.e. first need to access the .dt attribute. I'll have a pass through our code and see if there are other such occurences, so we can fix it everywhere.
Thanks @elephaint do you have any idea when this will available in a release ?
This may be a good opportunity to implement this in utilsforecast and add support for polars as well.
Thanks @elephaint do you have any idea when this will available in a release ?
Not yet