-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
to_dict doesn't convert np.int64 to python integers (second try) #24908
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 is fixed in soon to be release |
Note that actual closing PR is #23921 |
i'm still having this issue in version 0.25.1 |
@andrey999333 pls open a new issue with a reproducible example |
I also am getting this issue, but having trouble reproducing in a small example. In case it matters, I used |
I'm getting this issue as well in the latest pandas version (1.1.4). Haven't been able to create a small reproducible example either. I should mention that my code worked fine on 0.25.1. |
Code Sample, a copy-pastable example if possible
Problem description
Here I am just repeating here the description given my @Tomasz-Kluczkowski in #16048, which I believe is erroneously closed, because the issue still there in the latest stable version.
depending on the count of output columns, numpy integers getting converted to python integers
afterwards both json.dumps and ujson.dumps fails to encode
#13258 promises the solution for 0.21.0, but as seen above issue is still there in 0.23.4
Als workaround helps casting all types to strings bevor calling to_dict():
type(df[['id']].astype(object).to_dict(orient='records')[0]['id'])
<class 'int'>
Opening this as a new issue, because I cannot re-open the #16048.
Expected Output
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: