Description
There has been some discussion in #8162 and pandas2#17 about making Index
behave more like a regular Series or DataFrame column(s). Is there a consensus towards moving in that direction? In particular, I'm thinking about:
-
DatetimeIndex
,PeriodIndex
,TimedeltaIndex
could have a propertydt
that returnsself
. Then users can accessfoo.dt
without having to check whetherfoo
is aSeries
orIndex
. -
If
StringAccessorMixin
is deprecated (which can be done with a tiny subset of WIP: Refactor accessors, unify usage, make "recipe" #17042),Index
can have_accessors
,_dir_deletions
, and_dir_additions
copy/pasted fromSeries
. -
Less obvious so more of an implied question:
Index.map
seems to behave a lot likeSeries.apply
and less likeSeries.map
. Any reason not to aliasIndex.apply = Index.map
?
Related Index/MultiIndex compat, a non-multi Index could have self.levels = [self]
, so users can iterate over levels without pre-checking.