-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TimedeltaIndex should have a method to help to convert to string (with a custom format with microsecond resolution) #26897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We mirror standard library methods in the |
Maybe |
Given that a See http://strftime.org/ for reference about Python's In fact we should even have 2 codes for sign
others codes to support should be (at least)
maybe some additional code could be added such as
to support locale’s equivalent of minute, second, microsecond (using singular or plural form) |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I noticed in doc https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.dt.strftime.html that
DatetimeIndex
have adt
attribute which can help to convert aTimestamp
to string.(or
rng.to_series().dt.strftime('%B %d, %Y, %r')
)A similar method should exist for
TimedeltaIndex
to help to convert it to string (it's especially useful to output an Excel files without "0 days" for each index when each timedelta is below 1 day)I have found a bad method to do this:
unfortunatelly it doesn't support the "f" specifier for microsecond (I only need in fact millisecond)
it could be nice to simply be able to do
or naming attribute
td
(instead ofdt
) to avoid confusion betweenDatetimeIndex
andTimedeltaIndex
or even simplier
I think a workaround to achieve this is (with positive
Timedelta
) to add epoch and so manageTimestamp
instead.But I'm still wondering how to manage negative
Timedelta
such asAny idea?
Kind regards
PS : related issue #17232 (about display of negative Timedelta)
The text was updated successfully, but these errors were encountered: