BUG: strftime can give incorrect answers #46851
Labels
Bug
Constructors
Series/DataFrame/Index/pd.array Constructors
Timestamp
pd.Timestamp and associated methods
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
It is valid to enter a number of nanoseconds that is greater than 1000, but the constructor does not convert this to microseconds, so when strftime is called it seems to take only the value of the microsecond property.
Expected Behavior
It is expected that t1 and t2 should always give the same strftime in all cases. Note that microsecond errors if given a number over 999999 and I think the behaviour of erroring when given a nanosecond over 999 would be fine, and guarantee correct behaviour.
Installed Versions
For some reason this failed with an assertion error, but I do not think that is relevant to this report.
The text was updated successfully, but these errors were encountered: