-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TypeError: mean() got an unexpected keyword argument 'dtype' #4290
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
Comments
the mean call looks to be in the numeric code |
damn -- my reply didn't post from email for some reason here it all is: On Thu, 18 Jul 2013, jreback wrote:
yeap -- but it calls ok -- there seems to be indeed a recent change in numpy in 'mean':
so the first check changed:
which changed nothing for us here I believe... so I am a bit confused... but here is a proof that it used to work before ;):
and there such call results in numpy's code:
so -- it called pandas' mean providing None's for dtype and out as positional |
is there a reason you are not calling DataFrame(....),mean() or you can directly pass np.mean(DataFrame(...).values) pandas mean doesn't accept these extra arguments; I believe they are also somewhat new in numpy a frame can be heterogenous dtype so this is not really the same |
well -- I was not doing anything like that simply because it was working as it should have before. And I assumed that numpy would first 'asanyarray' its argument, but it seems to be just falls through for anything which has 'mean' -- which is imho a wrong logic... as such, you are free to close it -- I think I will whine on numpy issues/list about it... alternatively you could implement dtype allowing e.g. with dtypes per column. Then you might save mortals like me some time adjusting our codes ;) |
on the second thought -- I think you might still like to maintain compatibility with numpy's mean API. I thought that DataFrames with those methods were "incepted" with idea of easy integration with numpy routines, etc. So it might be logical to maintain such compatibility, especially when it comes at low cost, e.g. here even adding a dummy "dtype=None" default kwarg and then raising TypeError only if non-None dtype is provided, already might come handy at times |
you are using numpy 1.8 dev here? I guess that's an API change from them..... |
closing in favor of #4435 (same issue) |
Numpy 1.8 API change in mean?
complete "line" calling this is
it used to work before ... did not check for sure yet though if it is pandas or recent numpy upgrade (if I did any)
more information:
and if to provide ndarray compatibility here then interface should match numpy's where dtype is a valid argument to mean
The text was updated successfully, but these errors were encountered: