DEPR: Deprecate week, weekofyear in Series.dt,DatetimeIndex by mgmarino · Pull Request #33595 · pandas-dev/pandas (original) (raw)

hmm you mean the index of the original dataframe? I think we do this on the accessors, so we should do this.

Yes, I mean that the DataFrame returned by DatetimeIndex.isocalendar() should probably have its index set to the DatetimeIndex. This is done e.g. in Series.dt.isocalendar(): the returned DataFrame has it's index set to that of the Series.

For Index classes, the current behavior of inherit_names when wrapping is to convert the result of the delegated call to the same type if possible (i.e. DatetimeIndex => DatetimeIndex) and to fall back to a generic Index if not.

DatetimeIndex.isocalendar does not set the index on the returned dataframe,
leading to some cumbersome syntax

agreed

Ok, the question would then be where to do this: