-
Notifications
You must be signed in to change notification settings - Fork 748
Cannot convert Numpy Float64 array to double[] #1887
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
We don't include non-trivial conversions by default anymore. You should use a codec like this for the conversion: https://github.com/fdieulle/pandasnet/blob/main/dotnet/PandasNet/NumpyCodec.cs |
Hi @filmor, However, for the conversion of a numpy.float64 I keep ending up in a conversion error within pythonnet. I did this and then called my conversion function:
Internally in the NumpyCodecs.cs it's then mapped to the pythonnet function
but when this is executed, I'm getting the mentioned conversion exception within pythonnet. I'm not sure how this is supposed to work. I'm also not sure if I should report this issue in here or in the pandasnet github repo tbh. Any help is highly appreciated. It should be also easy to reproduce. |
Environment
Details
Hi,
We want to update our PythonEnvironment (conda env) to 3.10 (previously were using 3.7). Therefore I'm trying to update the our used pythonnet version to the latest prerelease one. (3.0.0-rc4 right now) However, when doing so, our unit tests for converting 1, 2 and 3 dimensional numpy (float) arrays to a CLR (double[] type) are breaking. I debugged it and could nail it down to be reproducible using the following code (which executes using version 3.0.0-preview2021-08-03):
This throws an
InvalidCastException
inAsManagedObject
:Let me know if you need something else or if I made a mistake. We were initially using pythonnet version 2.5.2 but I tried to refactor and change all the code as required for 3.0.0.
Help is highly appreciated. I couldn't find something/someone else that is having problems converting numpy arrays. Which seems a bit weird to me.
Thanks for your efforts developing this great and helpful library, keep it up!
Cheers,
Lukas
The text was updated successfully, but these errors were encountered: