-
Notifications
You must be signed in to change notification settings - Fork 33
NotImplementedError error when using z_from_p with pandas DataFrame #74
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
This works, so I think the problem is with z_from_p
|
It works with an analogous situation using xarray, and we test with xarray but not Pandas. Why it works for one function and not another with Pandas, I don't know. The error is coming from inside Pandas.
This seems to me to be a bug, or at least a major shortcoming, in |
I'm curious about the phrase "mixed DataFrame and Series inputs." In my example, I'd think that both df['pressure'] and df['latitude'] are Series. |
They are Series. That's what I showed in the previous comment. The problem is that z_from_p has two optional arguments which default to zero, but which could be arrays. They have been converted to ndarrays by the point at which the error occurs. The error message is incorrect. The case that is not implemented is not "mixed DataFrame and Series" but mixed Series and numpy.ndarray. |
Strangely, it works if only one of the two required arguments is an ndarray:
(Same with only the second argument being an ndarray.) |
@DocOtak found this bug last month and created an issue for it on the Pandas site: pandas-dev/pandas#39853. |
Last time I looked at the pandas code (when I filed the bug over there), their |
Looks like there is a PR upstream to fix pandas-dev/pandas#39853. xref.: pandas-dev/pandas#48280 |
Woah, I hope it works. |
The upstream fix has landed and should be included in pandas 1.6. |
Excellent, thank you! |
This one can be closed now. Pandas 2.0 does support this and we added a regression test in #126. |
I had code that was perhaps broken by the latest release.
It seems like I used to be able to use Series from a pandas DataFrame as arguments to gsw.z_from_p(). I.e. this worked:
but with v3.4.0, the same code gives me this error.
This works:
What is the appropriate behavior here?
Thanks,
Liz
The text was updated successfully, but these errors were encountered: