-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
DataFrame.to_dict returning numpy scalars in certain cases #23753
Comments
pretty sure this is a duplicate issue |
As I said, I searched for it but didn't see one directly. But if you find one, happy to close this as a duplicate. For iteration there are other issues, but here for |
Not directly related to this issue, but: an option to convert missing values to None would also be nice for my use case. Although that might add quite some complexity to the implementation (and you can do it yourself relatively easy) |
@jreback I am working on the issue. The source of it is usage of |
I think in general we try to return python scalars instead of numpy scalars in
to_dict
(similar as intolist
or iteration).Eg:
However, this is not consistent, and eg when using
orient='records'
:In this case, that is because of iterating over
self.values
in the 'records' implementation (which also means that if you have a string column,self.values
will be object dtype, and you actually get python scalars)There are a bunch of other issues related to iteration (eg #20791, #13468), but didn't see one specifically related to
to_dict
.The text was updated successfully, but these errors were encountered: