-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
nan type drift for np.nan #626
Comments
...and you are saying that pickling a |
Yeah to my experience this is pretty universal for dill / pickle, even in different import scenarios. I did a little digging and appears that the Numpy version of np.nan refers to some global representation such that the root of matter is that After thinking about it, for my specific use case in the Automunge library decided to remove exposure to nan dictionary key scenario and use None in place of nan, so if you want to close this issue I think my concern is resolved by that update. Thanks |
I'm going to reopen this issue, as I think the |
This issue appears to be common for dill and pickle, when serializing and recovering dictionaries populated with np.nan entries drift their data type to the default of float("nan"). Normally this shouldn't be a big deal as they both adhere to IEEE 754, except that python dictionaries have an edge case / incongruity for the two nan types when using nan as a key. Specifically, for the dictionary e.g. a_dict = {np.nan:1234} one can access the value with a_dict[np.nan}, but for the dictionary b_dict = {float("nan"):4321}, attempting to access b_dict[float("nan")] returns a halt bug, and similarly for other dictionary methods like .pop().
Ideally for a serialized dictionary one could be able to retain the nan type such as to retain any peculiarities of this nature.
The text was updated successfully, but these errors were encountered: