Skip to content Skip to sidebar Skip to footer

String Formatting Of Timedeltas In Pandas

I noticed that Pandas knows how to smartly format a timedelta object into a string. In [1]: df[column][rows].max() Out[1]: 0 2 days, 02:08:07 dtype: timedelta64[ns] When I try

Solution 1:

The function is located here:

pd.tslib.repr_timedelta64

In action:

In [11]: pd.tslib.repr_timedelta64(np.timedelta64(180487000000000,'ns'))
Out[11]: '2 days, 02:08:07'

Post a Comment for "String Formatting Of Timedeltas In Pandas"