diff --git a/doc/source/whatsnew/v1.0.1.rst b/doc/source/whatsnew/v1.0.1.rst index ff8433c7cafd9..1a5a420ab8b55 100644 --- a/doc/source/whatsnew/v1.0.1.rst +++ b/doc/source/whatsnew/v1.0.1.rst @@ -86,6 +86,7 @@ MultiIndex I/O ^^^ +- Fixed regression in :meth:`~DataFrame.to_csv` where specifying an ``na_rep`` might truncate the values written (:issue:`31447`) - - diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index 22901051ec345..9e31ccebd0f1b 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -684,7 +684,10 @@ def to_native_types(self, slicer=None, na_rep="nan", quoting=None, **kwargs): itemsize = writers.word_len(na_rep) if not self.is_object and not quoting and itemsize: - values = values.astype(f"