diff --git a/doc/source/whatsnew/v1.0.1.rst b/doc/source/whatsnew/v1.0.1.rst index 95fab6a18ffe1..16e463e3a5944 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 5fcd796eb41ed..6f2bcdb495d01 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -680,7 +680,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"