Open
Description
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
In [13]: import pandas as pd
In [14]: df = pd.DataFrame([1, pd.NA], dtype="Int64")
In [15]: df.to_string(na_rep="foo")
Out[15]: ' 0\n0 1\n1 <NA>'
In [16]: df.to_xml(na_rep="foo")
--> 283 raise TypeError(f"Invalid value '{str(value)}' for dtype {self.dtype}")
TypeError: Invalid value 'foo' for dtype Int64
Issue Description
Since these should output textual representations of the data, I would expect pd.NA
to be replaced with a string na_rep
Expected Behavior
Since these should output textual representations of the data, I would expect pd.NA
to be replaced with a string na_rep
Installed Versions
Replace this line with the output of pd.show_versions()