我对NumPy
不熟悉,我正在尝试计算一些简单的统计信息,比如median
或{
我想探讨的“列”之一是时间差(它的类型是timedelta64
NumPy
类型),但我不能直接应用那些统计ufuncs
:
----> 1 age_request.std()
TypeError: ufunc 'divide' not supported for the input types, and the inputs could not be
safely coerced to any supported types according to the casting rule 'safe'
为什么会这样?
我知道我应该研究Pandas
,但首先我想熟悉一下{
看看documentation for datetime。它列出了可以对
timedelta
对象执行的操作。划分如下:请注意,这会计算底限,并丢弃任何剩余部分。在
据我所知,您只能对
timedelta
对象执行这些操作。虽然我可能错了,您可以使用numpy
操作。在我建议将
^{pr2}$timedelta
对象转换为微秒,然后进行除法、标准差、中值等操作:(不过,我应该补充说,我不完全确定python可以存储的最大整数值是多少,以及
tdMicrosecs
是否可以超过它。)相关问题 更多 >
编程相关推荐