Closed
Description
The current to_json_plotly
doesn't handle dicts with integers and strings as keys. This used to work before we set sort_keys=True
.
This is relatively common in Dash.
Here is a MWE:
import pandas as pd
from plotly.io.json import to_json_plotly
df = pd.DataFrame({'a': [0], 1: [0]})
to_json_plotly(df.to_dict('records'))
TypeError: '<' not supported between instances of 'int' and 'str'
Here is the issue in the Python tracker: https://bugs.python.org/issue25457 re sort_keys=True
Originally reported in https://community.plotly.com/t/dash-2-0-0-migration-error/56478/7