-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Duplicate ReportDuplicate issue or pull requestDuplicate issue or pull request
Description
I have a dataframe that I need to convert to a dict
and add it to another dict
which is converted to json in the end. Unfortunately since .to_dict()
does not use standard python types I get the following:
TypeError: Object of type 'int32' is not JSON serializable
My code is something like the following:
output = {
'foo': 1,
'bar': 2
}
...
df = ...
output['baz'] = df.to_dict()
send(json.dumps(output))
Using dumps
results in the above error. This is related to #13258 where an 'easy way' was mentioned but I'm not sure what it is.
Would appreciate any help
Metadata
Metadata
Assignees
Labels
Duplicate ReportDuplicate issue or pull requestDuplicate issue or pull request