我timedelta64值的熊猫系列:熊猫系列功能一致性
>>>diff
0 NaT
1 00:10:04
2 00:10:03
3 00:11:28
.....
44 00:05:13
45 00:00:40
46 00:03:22
47 00:00:58
Name: sample_time, dtype: timedelta64[ns]
我不知道为什么均值()和STD()方法返回我两种不同类型的对象。一个返回一系列对象,而其他收益通用浮点值(甚至没有另一个timedelta64):
>>>diff.mean()
0 00:07:30.510638
dtype: timedelta64[ns]
>>>type(diff.mean())
<class 'pandas.core.series.Series'>
>>>diff.std()
1.3312791471041715e+18
>>>type(diff.std())
<type 'numpy.float64'>
熊猫documentation on series描述了一个非常相似的时装两个函数,然后不指示返回哪一类的对象。引用的文件:
平均值([轴,skipna,水平,numeric_only]):返回针对所请求的轴STD([轴,skipna,水平,ddof])的 值的平均值: 返回无偏所请求的轴上的标准偏差。
不知道为什么会发生,而是'pandas'呼吁'numpy.mean,'所以你可以从那里开始。 – chrisb 2014-09-25 18:15:52