Skip to content

TypeError: When using orjson and serializing pandas.NA #5039

Description

@DavidKatz-il

Reproduce the issue:

  1. Install the orjson library.
  2. Execute the following code:
import pandas as pd
from plotly.io.json import to_json_plotly

to_json_plotly(pd.NA)

An error occurs when running the code:

Traceback (most recent call last):
  File "/opt/conda/envs/dev/lib/python3.10/site-packages/plotly/io/_json.py", line 171, in to_json_plotly
    return _safe(orjson.dumps(cleaned, option=opts).decode("utf8"), _swap_orjson)
TypeError: Type is not JSON serializable: NAType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P1needed for current cyclebugsomething broken

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions