BUG: df.apply handles np.timedelta64 as timestamp, should be timedelta #7778
Labels
Bug
Datetime
Datetime data dtype
Dtype Conversions
Unexpected or buggy dtype conversions
Timedelta
Timedelta data type
Milestone
I think there may be a bug with the row-wise handling of
numpy.timedelta64
data types when usingDataFrame.apply
. As a check, the problem does not appear when usingDataFrame.applymap
. The problem may be related to #4532, but I'm unsure. I've included an example below.This is only a minor problem for my use-case, which is cross-checking timestamps from a counter/timer card. I can easily work around the issue with
DataFrame.itertuples
etc.Thank you for your time and for making such a useful package!
Example
Version
Import and check versions.
Create test data
Using subset of original raw data as example.
Compute datetimes from elapsed timedeltas, then create differential timedeltas from datetimes. All elements are either type
numpy.datetime64
ornumpy.timedelta64
.Expected behavior
With element-wise handling using
DataFrame.applymap
, all elements are correctly identified as datetimes (timestamps) or timedeltas.Bug
With row-wise handling using
DataFrame.apply
, all elements are typepandas.tslib.Timestamp
. I expected 'differential_timedeltas' to be typenumpy.timedelta64
or another type of timedelta, not a type of datetime (timestamp).The text was updated successfully, but these errors were encountered: