Skip to content

diff(0) causes ValueError on Series and TimeSeries #3257

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
jayzed82 opened this issue Apr 4, 2013 · 2 comments
Closed

diff(0) causes ValueError on Series and TimeSeries #3257

jayzed82 opened this issue Apr 4, 2013 · 2 comments
Labels
Milestone

Comments

@jayzed82
Copy link

jayzed82 commented Apr 4, 2013

import pandas as pd
import scipy as sp

df = pd.DataFrame(sp.randn(5,2))
ts = df[0]

If you run: df.diff(0)

Out[43]:
0 1
0 0 0
1 0 0
2 0 0
3 0 0
4 0 0

This works as expeted but if you run ts.diff(0) :


ValueError Traceback (most recent call last)

/home/jzunigavu/workspace/hf_vol_data/predictor_curves/ in ()

/home/jzunigavu/.local/lib/python2.7/site-packages/pandas-0.10.1-py2.7-linux-x86_64.egg/pandas/core/series.pyc in diff(self, periods)
1736 diffed : Series
1737 """
-> 1738 result = com.diff(self.values, periods)
1739 return Series(result, self.index, name=self.name)
1740

/home/jzunigavu/.local/lib/python2.7/site-packages/pandas-0.10.1-py2.7-linux-x86_64.egg/pandas/core/common.pyc in diff(arr, n, axis)
489 lag_indexer = tuple(lag_indexer)
490
--> 491 out_arr[res_indexer] = arr[res_indexer] - arr[lag_indexer]
492
493 return out_arr

ValueError: operands could not be broadcast together with shapes (5) (0)

changhiskhan pushed a commit that referenced this issue Apr 5, 2013
@jreback
Copy link
Contributor

jreback commented Apr 7, 2013

@changhiskhan close this?

@changhiskhan
Copy link
Contributor

yes please
On Apr 7, 2013 7:37 AM, "jreback" [email protected] wrote:

@changhiskhan https://github.com/changhiskhan close this?


Reply to this email directly or view it on GitHubhttps://github.com//issues/3257#issuecomment-16013596
.

@jreback jreback closed this as completed Apr 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants