ramp-kits / air_passengers

Air passengers RAMP starting kit
https://www.ramp.studio/problems/air_passengers
6 stars 29 forks source link

Fix minimal version for pandas #13

Open rth opened 3 years ago

rth commented 3 years ago

Following https://github.com/ramp-kits/air_passengers/pull/12 the starting kit with pandas <1.1.0 fails with,

      8 X_encoded['day'] = X_encoded['DateOfDeparture'].dt.day
      9 X_encoded['weekday'] = X_encoded['DateOfDeparture'].dt.weekday
---> 10 X_encoded['week'] = X_encoded['DateOfDeparture'].dt.isocalendar().week
     11 X_encoded['n_days'] = X_encoded['DateOfDeparture'].apply(lambda date: (date - pd.to_datetime("1970-01-01")).days)

AttributeError: 'DatetimeProperties' object has no attribute 'isocalendar'

there is not really a good solution to keep it backward compatible, because Series.dt.week is deprecated in 1.1, and Series.dt.isocalendard didn't exist before 1.1 https://github.com/pandas-dev/pandas/pull/33220. So I think restricting pandas to >1.1 is fine.

rth commented 3 years ago

This event wasn't yet deployed on the server with the new version of the starting kit notebook, as far as I know, so it should be fine I think..

agramfort commented 3 years ago

ok !