DataProfiler: diff_report = profile1.diff(profile2) -> Object of type int64 is not JSON serializable
General Information:
- OS: OSX
- Python version: python 3.8
- Library version: current
Describe the bug:
Object of type int64 is not JSON serializable
Problem:
'conservative': {'df': xxxx, 'p-value': 0.0}, 'welch': {'df': xxxx, 'p-value': 0.0}}
To Reproduce:
diff_report = profile1.diff(profile2)
json.dumps(diff_report)
Expected behavior:
Screenshots:
Additional context:
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 29 (11 by maintainers)
Excellent - thanks, both!
Fix incoming soon: @turtlemonvh, ty for identifying the issue!
I ran into this issue using the example in your README (https://github.com/capitalone/DataProfiler/blob/main/README.md), which uses
So I think it would make sense to either
compactdoesn’t hit this serialization errorserializableso people know to use that when dumping to JSON@turtlemonvh The fix only alters the profile if serializable is requested such that the profile_schema still matches the original dataframe which was input. Hence, either
serializableorprettymust be set as the option.LMK if you think that it should be otherwise.
@turtlemonvh till fix, a work around would be to set the column headers or if profile_schema contains keys which are np.int64 to convert them to integers
Yup, got the bug.
@turtlemonvh which version of python?
EDIT: nvm i see py3.8?
@taylorfturner this might be dataset dependent, e.g. if the dataset itself has columns.
Yeah that worked.
Yep - I can’t share the data, but the code is pretty much straight out of your readme.
I’ll take a look at the structure of the
Profilerobject now to see if anything pops out.EDIT: I have
profile.report()pulled up in an ipython shell now if there is anything in particular you want me to check in that output.I’m hitting something similar on v0.7.10
I tried 3 formatting options (from: https://capitalone.github.io/DataProfiler/docs/0.7.10/html/profiler.html#reporting-structure) and received these errors