Is your feature request related to a problem?
Series of type timedelta64
have the very useful Series.dt.components
property. There seems to be no particular reason why this property is missing for datetime64
-types.
Describe the solution you'd like
I gathered the following table of what attributes Series.dt
carries for datetime64
and timedelta64
data types:
scale | datetime | timedelta |
---|---|---|
--- | components | |
Y | year | --- |
M | month | --- |
D | day | days |
h | hour | --- |
m | minute | --- |
s | second | seconds |
ms | --- | --- |
us | microsecond | microseconds |
ns | nanosecond | nanoseconds |
Note that Series.dt.components
has entries for all scales from day to nanoseconds in the case of timedelta
dtype.
I propose to make the table consistent and add most of the missing entries:
- add
dt.components
fordatetime
types; it should return aint64
-DataFrame
with an entry for every scale. - add millisecond / milliseconds for both - kind of weird that this is missing to begin with when both micro- and nanoseconds are implemented, and
dt.components
returns a column for milliseconds. - add
minutes
andhours
fortimedelta
type - adding
years
/months
totimedelta
seems implausible since these are not directly convertible to SI-units.
Comment From: jgarba
Take