Skip to content

Commit 6b4d5f7

Browse files
committed
DOC update DataFrame.to_csv write modes (pandas-dev#51839)
1 parent a07cb65 commit 6b4d5f7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pandas/core/generic.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3630,9 +3630,13 @@ def to_csv(
36303630
sequence should be given if the object uses MultiIndex. If
36313631
False do not print fields for index names. Use index_label=False
36323632
for easier importing in R.
3633-
mode : str, default 'w'
3634-
Python write mode. The available write modes are the same as
3635-
:py:func:`open`.
3633+
mode : {{'w', 'x', 'a'}}, default 'w'
3634+
Python write mode. The available write modes are:
3635+
3636+
- 'w', opens the file for writing and truncates the file if it already exists. If the file does not exist, it creates a new file.
3637+
- 'x', opens the file for exclusive creation, meaning it will fail if the file already exists. If the file does not exist, it creates a new file.
3638+
- 'a', opens the file for writing in append mode. The data is written to the end of the file, without truncating it. If the file does not exist, it creates a new file.
3639+
36363640
encoding : str, optional
36373641
A string representing the encoding to use in the output file,
36383642
defaults to 'utf-8'. `encoding` is not supported if `path_or_buf`

0 commit comments

Comments
 (0)