Cannot Get The Average Date Using Pandas
I have a time series data set from which I want to get an average date. Here is a contrived example that shows an overflow error of pandas datetime64 object: import pandas as pd im
Solution 1:
This is a known issue, see here. It is a straightforward fix and on the list. As a work-around, cast to milliseconds, mean, and back.
In [14]: pd.to_timedelta((s-s.min()).astype('m8[ms]').mean(),unit='ms')
Out[14]: Timedelta('249 days 12:00:00')
Post a Comment for "Cannot Get The Average Date Using Pandas"