pd.Timedelta.resolution is different from datetime.timedelta.resolution · Issue #21344 · pandas-dev/pandas (original) (raw)
timedelta.resolution
is documented as:
The smallest possible difference between non-equal timedelta objects, timedelta(microseconds=1).
while pandas.Timedelta.resolution
is doc-string'd as:
return a string representing the lowest resolution that we have
In [9]: pd.Timedelta(minutes=30).resolution
Out[9]: 'T'
In [10]: timedelta(minutes=30).resolution
Out[10]: datetime.timedelta(0, 0, 1)
I think this difference should be addressed by either:
- Documenting the difference between both but also supporting
datetime.timedelta
's notion of resolution inTimedelta
(i.e. something that returnsTimedelta(nanoseconds=1)
) - Making
Timedelta.resolution
consistent withtimedelta.resolution
and creating a new property for "the lowest resolution" of aTimedelta
instance
Thoughts?
xref #21336