-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
Numeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operationsTimedeltaTimedelta data typeTimedelta data type
Milestone
Description
edit: it seems like the bug is that var returns numeric values for the operation, instead of timedeltas like .std (#18880 (comment))
Working on the empty / all-NA stuff. This is related, but separate.
Currently for an all-NA series of timedelta's, we return NaT for .var() on an empty series (see Out[44]). I think this should be NaN since the reduction is returning numeric values, not timedeltas.
In [40]: s = pd.Series(pd.timedelta_range(0, periods=12, freq='S'))
In [41]: s[0] = np.nan
In [42]: s.var()
Out[42]: 1.1e+19
In [43]: s.var(skipna=False)
Out[43]: nan
In [44]: s[:0].var()
Out[44]: NaTI've just noticed some other buggy behavior with aggregations on timedeltas, so maybe this can become a meta-issue about timedeltas and numeric aggregations:
In [57]: s.sum(skipna=False)
Out[57]: Timedelta('-106752 days +00:13:49.145223')I'm guessing we improperly add the timedelta min here.
Metadata
Metadata
Assignees
Labels
Numeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operationsTimedeltaTimedelta data typeTimedelta data type