Skip to content

pd.NA na_rep truncated in to_csv #29975

Closed
@WillAyd

Description

@WillAyd

Just found this while messing around with how the new pd.NA sentinel would work with extension modules

>>> pd.Series(["a", pd.NA, "c"]).to_csv(na_rep="ZZZZZ")
',0\n0,a\n1,ZZZZZ\n2,c\n'
>>> pd.Series(["a", pd.NA, "c"], dtype="string").to_csv(na_rep="ZZZZZ")
',0\n0,a\n1,ZZ\n2,c\n'

Note the latter is truncated to two letters

@jorisvandenbossche

Metadata

Metadata

Assignees

Labels

IO CSVread_csv, to_csvMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateOutput-Formatting__repr__ of pandas objects, to_string

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions