-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Labels
IO JSONread_json, to_json, json_normalizeread_json, to_json, json_normalizeNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arrays
Milestone
Description
Code Sample
import numpy as np
import pandas as pd
pd.DataFrame([[np.nan]], columns=["NA"]).to_json(orient="records")
# '[{"NA":null}]'
pd.DataFrame([[None]], columns=["NA"]).to_json(orient="records")
# '[{"NA":null}]'
pd.DataFrame([[pd.NA]], columns=["NA"]).to_json(orient="records")
# '[{"NA":{}}]'
Problem Description
pd.NA
should behave as np.nan
and None
when converting a DataFrame to JSON.
Expected Output
In the resulting JSON the pd.NA
instances should be converted to JSON's null
.
Metadata
Metadata
Assignees
Labels
IO JSONread_json, to_json, json_normalizeread_json, to_json, json_normalizeNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arrays