We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3ce150d commit 4116297Copy full SHA for 4116297
pandas/core/generic.py
@@ -3450,6 +3450,17 @@ def to_csv(
3450
... archive_name='out.csv') # doctest: +SKIP
3451
>>> df.to_csv('out.zip', index=False,
3452
... compression=compression_opts) # doctest: +SKIP
3453
+
3454
+ Create 'out.csv' in a new folder 'folder/subfolder/'
3455
3456
+ >>> import os
3457
+ >>> os.mkdir('folder/subfolder',parents=True, exists_ok=True)
3458
+ >>> df.to_csv('out.csv')
3459
3460
+ >>> from pathlib import Path
3461
+ >>> filepath = Path('folder/subfolder/out.csv')
3462
+ >>> filepath.parent.mkdir(parents=True, exist_ok=True)
3463
+ >>> df_to_csv(filepath)
3464
"""
3465
df = self if isinstance(self, ABCDataFrame) else self.to_frame()
3466
0 commit comments