Skip to content
Snippets Groups Projects
Unverified Commit 2d760b93 authored by David Hoese's avatar David Hoese
Browse files

Force ints to floats so they can be json serialized

parent e2a7fc70
Branches
No related tags found
No related merge requests found
...@@ -160,6 +160,10 @@ def handle_csv(frame, epoch, sep=',', ...@@ -160,6 +160,10 @@ def handle_csv(frame, epoch, sep=',',
@as_json_p(optional=True) @as_json_p(optional=True)
def handle_json(frame, epoch, order='columns', def handle_json(frame, epoch, order='columns',
message='', code=200, status='success', **kwargs): message='', code=200, status='success', **kwargs):
# force conversion to float types so they can be json'd
for column, data_type in zip(frame.columns, frame.dtypes.values):
if issubclass(data_type.type, np.integer):
frame[column] = frame[column].astype(float)
# replace NaNs with None # replace NaNs with None
frame = frame.where(pd.notnull(frame), None) frame = frame.where(pd.notnull(frame), None)
output = {} output = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment