Json handler error

I am getting this weird error, it seems it is unable to process my pandas series, any ideas?
this is the traceback

Traceback (most recent call last):
18:32:16 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/middlewares.py”, line 15, in call
18:32:16 web.1 | return super(StaticDataMiddleware, self).call(environ, start_response)
18:32:16 web.1 | File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 766, in call
18:32:16 web.1 | return self.app(environ, start_response)
18:32:16 web.1 | File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 766, in call
18:32:16 web.1 | return self.app(environ, start_response)
18:32:16 web.1 | File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/werkzeug/local.py”, line 228, in application
18:32:16 web.1 | return ClosingIterator(app(environ, start_response), self.cleanup)
18:32:16 web.1 | File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wrappers.py”, line 308, in application
18:32:16 web.1 | resp = f(*args[:-2] + (request,))
18:32:16 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 88, in application
18:32:16 web.1 | response = handle_exception(e)
18:32:16 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 146, in handle_exception
18:32:16 web.1 | response = frappe.utils.response.report_error(http_status_code)
18:32:16 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/response.py”, line 32, in report_error
18:32:16 web.1 | response = build_response(“json”)
18:32:16 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/response.py”, line 49, in build_response
18:32:16 web.1 | return response_type_mapfrappe.response.get(‘type’) or response_type
18:32:16 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/response.py”, line 75, in as_json
18:32:16 web.1 | response.data = json.dumps(frappe.local.response, default=json_handler, separators=(’,’,’:’))
18:32:16 web.1 | File “/usr/lib/python2.7/json/init.py”, line 251, in dumps
18:32:16 web.1 | sort_keys=sort_keys, **kw).encode(obj)
18:32:16 web.1 | File “/usr/lib/python2.7/json/encoder.py”, line 207, in encode
18:32:16 web.1 | chunks = self.iterencode(o, _one_shot=True)
18:32:16 web.1 | File “/usr/lib/python2.7/json/encoder.py”, line 270, in iterencode
18:32:16 web.1 | return _iterencode(o, 0)
18:32:16 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/response.py”, line 126, in json_handler
18:32:16 web.1 | (type(obj), repr(obj)))
18:32:16 web.1 | TypeError: Object of type <class ‘pandas.core.series.Series’> with value of 0 5.0
18:32:16 web.1 | 1 40
18:32:16 web.1 | 2 60
18:32:16 web.1 | 3 70
18:32:16 web.1 | Name: weight, dtype: object is not JSON serializable
18:32:25 worker_short.1 | 18:32:25 short:

1 Like