Skip to content

Commit c99981a

Browse files
linus-mdmroeschke
andauthored
DOC: add simple example to DataFrame.to_csv() (#56342)
* DOC: add simple example to DataFrame.to_csv() * update * add doctest skip * Update pandas/core/generic.py Co-authored-by: Matthew Roeschke <[email protected]> * Update pandas/core/generic.py Co-authored-by: Matthew Roeschke <[email protected]> --------- Co-authored-by: Matthew Roeschke <[email protected]>
1 parent 33ff3d9 commit c99981a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/core/generic.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -3950,14 +3950,17 @@ def to_csv(
39503950
39513951
Examples
39523952
--------
3953+
Create 'out.csv' containing 'df' without indices
3954+
39533955
>>> df = pd.DataFrame({{'name': ['Raphael', 'Donatello'],
39543956
... 'mask': ['red', 'purple'],
39553957
... 'weapon': ['sai', 'bo staff']}})
3956-
>>> df.to_csv(index=False)
3957-
'name,mask,weapon\nRaphael,red,sai\nDonatello,purple,bo staff\n'
3958+
>>> df.to_csv('out.csv', index=False) # doctest: +SKIP
39583959
39593960
Create 'out.zip' containing 'out.csv'
39603961
3962+
>>> df.to_csv(index=False)
3963+
'name,mask,weapon\nRaphael,red,sai\nDonatello,purple,bo staff\n'
39613964
>>> compression_opts = dict(method='zip',
39623965
... archive_name='out.csv') # doctest: +SKIP
39633966
>>> df.to_csv('out.zip', index=False,

0 commit comments

Comments
 (0)