You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The json library, encoder module, raises a TypeError exception, which I think should not be raised. Hence I think the Series.tolist() method may be at fault here and not json standard library.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.4/json/__init__.py", line 230, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python3.4/json/encoder.py", line 192, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.4/json/encoder.py", line 250, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python3.4/json/encoder.py", line 173, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: 1 is not JSON serializable
I am aware of Series.to_json() method, but I need to insert the values first into a nested dictionary which is only later serialized to JSON. That is how I came across this behaviour.
The
json
library,encoder
module, raises aTypeError
exception, which I think should not be raised. Hence I think theSeries.tolist()
method may be at fault here and notjson
standard library.Gives:
But
Works:
I am aware of
Series.to_json()
method, but I need to insert the values first into a nested dictionary which is only later serialized to JSON. That is how I came across this behaviour.Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: