Skip to content

Exception With np.frompyfunc #380

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
craustin opened this issue Nov 17, 2011 · 5 comments
Closed

Exception With np.frompyfunc #380

craustin opened this issue Nov 17, 2011 · 5 comments

Comments

@craustin
Copy link

from aqr.core.frame import DataFrame
import numpy as np
def func(a, b):
return a + b
df = DataFrame({'US':[1,2,3]})
f = np.frompyfunc(func, 2, 1)
print f.accumulate(df)

In pre-0.4.0 pandas, this printed:
US
0 1
1 3
2 6

Now, this:
ValueError: could not find a matching type for func (vectorized).accumulate, requested type has type code 'q'

@wesm
Copy link
Member

wesm commented Nov 18, 2011

I can't find a code revision where this works-- tried 0.4.0 and mid-august commit too, any help here? np.add.accumulate(df) works fine however. Are you using the same version of numpy for both?

@wesm
Copy link
Member

wesm commented Nov 18, 2011

The vectorized function above doesn't work on regular NumPy arrays so this may be a NumPy bug. I am using 1.6.1

@craustin
Copy link
Author

Yes, this works in 1.4.0. I'll close this issue as it's external.

@wesm
Copy link
Member

wesm commented Nov 18, 2011

Weird. i can create an issue on numpy/numpy on github

@lamblin
Copy link

lamblin commented Jan 20, 2012

I think you can work around the problem by specifying "dtype='object'":
print f.accumulate(df, dtype='object')

dan-nadler pushed a commit to dan-nadler/pandas that referenced this issue Sep 23, 2019
Revert "Revert "Revert "Merge pull request pandas-dev#363 from manahl/add-conca…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants