Skip to content

BUG: diff on a DataFrame with a datelike broken #4533

Closed
@jreback

Description

@jreback
In [10]: df = DataFrame(dict(time = [Timestamp('20130101 9:01'),Timestamp('20130101 9:02')],value=[1.0,2.0]))

In [11]: df
Out[11]: 
                 time  value
0 2013-01-01 09:01:00      1
1 2013-01-01 09:02:00      2

works on series

In [12]: df.time.diff()
Out[12]: 
0        NaT
1   00:01:00
Name: time, dtype: timedelta64[ns]

Broken with a datelike dtype inclded

In [13]: df.diff()
ValueError: cannot include dtype 'm' in a buffer

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignBugInternalsRelated to non-user accessible pandas implementationTimedeltaTimedelta data type

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions