Closed
Description
If I have a Series of timedelta64[ns]
(the result of a diff()
on a Timestamp Series in my case), doing mean, median, and quantile operations on that series returns inconsistent values. Example:
In [68]: s
Out[68]:
0 00:00:14.020705
1 00:00:14.020705
2 00:00:14.020705
3 00:00:28.041410
4 00:00:28.041410
5 00:00:42.062116
6 00:00:42.062116
7 00:00:42.062116
8 00:00:56.082821
9 00:02:20.207052
dtype: timedelta64[ns]
In [69]: s.mean()
Out[69]: 42062115618.0
In [70]: type(s.mean())
Out[70]: numpy.float64
In [71]: s.median()
Out[71]: 35051763015.0
In [72]: type(s.median())
Out[72]: float
In [73]: s.quantile(.95)
Out[73]: numpy.timedelta64(102351148003,'ns')
In [74]: type(s.quantile(.95))
Out[74]: numpy.timedelta64
As you can see, mean
and median
return a float (although the printed Out is a little different), but quantile
returns a single timedelta64[ns]
.
This is with versions pandas==0.12.0 and numpy==1.7.1