Skip to content

BUG: numpy_nullable NaNs do not round-trip through CSV #61617

Open
@jbrockmendel

Description

@jbrockmendel

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

arr = pd.array([0, pd.NA])
ser = pd.Series(arr) / 0
ser[2] = 3
df = ser.to_frame("A")

text = df.to_csv()

rt = pd.read_csv(StringIO(text), dtype_backend="numpy_nullable")[["A"]]

>>> df.loc[0, "A"]
np.float64(nan)
>>> rt.loc[0, "A"]
<NA>

Issue Description

This is a consequence of the constructor casting NaNs to pd.NA, xref #32265

Expected Behavior

NA

Installed Versions

Replace this line with the output of pd.show_versions()

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageIssue that has not been reviewed by a pandas team memberPDEP missing valuesIssues that would be addressed by the Ice Cream Agreement from the Aug 2023 sprint

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions