Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jreback opened this issue Aug 10, 2013 · 1 comment · Fixed by #8184
Closed

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

jreback opened this issue Aug 10, 2013 · 1 comment · Fixed by #8184
Labels
API Design Bug Internals Related to non-user accessible pandas implementation Timedelta Timedelta data type
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Aug 10, 2013

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
@jreback
Copy link
Contributor Author

jreback commented Sep 25, 2013

work-around is:

df.apply(Series.diff)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Bug Internals Related to non-user accessible pandas implementation Timedelta Timedelta data type
Projects
None yet
1 participant