저는 numpy에 익숙하지 않아 중간 값이나 stddev를 계산하는 것과 같은 간단한 통계에 사용하려고합니다. (팬더를 살펴 봐야하지만 처음에는 numpy을 익숙하게하고 싶습니다.) '항목'중 하나는 내가 탐구 할 시간 차이 (해당 유형 인 timedelta64의 NumPy와 타입)입니다,하지만 난 바로 그 통계 ufuncs를 적용 할 수 없습니다 :timedeltas를 numpy로 곱하거나 나눌 수없는 이유는 무엇입니까?
----> 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'
가 왜 그렇게입니까?
또는 Python> = 2.7 인 경우 timedelta.to_seconds()를 사용하면 부동 소수점 수를 초로 지정할 수 있습니다. – mtrw
아마도 더 잘 작동 할 것입니다! :) – carmenism
파이썬 3.3에서는 대신 timedelta.total_seconds()를 사용하십시오. –