@@ -221,6 +221,7 @@ In [1]: data = pd.DataFrame({
221221 ...: })
222222
223223In [2]: # When passing file PATH to to_csv, line_terminator does not work, and csv is saved with '\r\n'.
224+ ...: # Also, this converts all '\n's in the data to '\r\n'.
224225 ...: data.to_csv("test.csv", index=False, line_terminator='\n')
225226
226227In [3]: with open("test.csv", mode='rb') as f:
@@ -256,7 +257,7 @@ In [3]: with open("test.csv", mode='rb') as f:
256257b'string_with_lf,string_with_crlf\n"a\nbc","a\r\nbc"\n'
257258
258259
259- - On windows , the value of ``os.linesep`` is ``'\r\n'``,
260+ - On Windows , the value of ``os.linesep`` is ``'\r\n'``,
260261 so if ``line_terminator`` is not set, ``'\r\n'`` is used for line terminator.
261262- Again, it does not affects the value inside the data.
262263
@@ -274,8 +275,8 @@ In [3]: with open("test.csv", mode='rb') as f:
274275b'string_with_lf,string_with_crlf\r\n"a\nbc","a\r\nbc"\r\n'
275276
276277
277- - As default value of ``line_terminator`` changes, just passing file object with ``newline='\n' `` does not set ``'\n'`` to line terminator.
278- Pass ``line_terminator='\n' `` explicitly.
278+ - For files objects, specifying ``newline`` is not sufficient to set the line terminator.
279+ You must pass in the ``line_terminator`` explicitly, even in this case .
279280
280281.. code-block:: ipython
281282
0 commit comments