TypeError: Object of type 'Timestamp' is not JSON serializable
See original GitHub issueTrying to make a chart with pandas.Timestamp
on the X axis and a floating point value on the Y axis.
alt.Chart(data).mark_line().encode(
x='timestamp:T',
y='value:Q'
)
I get the following error:
TypeError: Object of type 'Timestamp' is not JSON serializable
Tried various date/time methods described here but I always get this error.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
TypeError: Object of type 'Timestamp' is not JSON serializable'
If you get an error TimeStamp has no attribute as "astype(str)" , you can try, for example, str(timeseries.index[0]) .
Read more >TypeError: Object of type Timestamp is not JSON serializable
The Python TypeError: Object of type Timestamp is not JSON serializable occurs when we try to convert a `Timestamp` object to a JSON...
Read more >Object of Type Datetime Is Not Json Serializable in Python
When we get the object of type datetime is not JSON serializable exception in Python, it means that the datetime object cannot be...
Read more >TypeError: Object of type Timestamp is not JSON serializable
TypeError : Object of type Timestamp is not JSON serializable - I have tried to fix to no avail, any suggestions or help?...
Read more >TypeError: Object of type 'Timestamp' is not JSON serializable ...
If you get an error TimeStamp has no attribute as "astype(str)" , you can try, for example, str(timeseries.index[0]) . This will convert the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, altair will serialize the entire dataset that you build a chart with, because it’s difficult to determine from the Python side which columns the renderer will reference.
Glad the problem is fixed!
Ahh, I had some other columns that were of type
object
and dropping those resolves the error. I was not aware that unused columns would cause an issue like that. Thanks for you help!