Skip to content

Commit bb7ab75

Browse files
author
m-dz
committed
Add extended summary and see also, amend parameters
1 parent 2a0d23b commit bb7ab75

File tree

1 file changed

+43
-33
lines changed

1 file changed

+43
-33
lines changed

pandas/core/frame.py

+43-33
Original file line numberDiff line numberDiff line change
@@ -1494,70 +1494,80 @@ def to_csv(self, path_or_buf=None, sep=",", na_rep='', float_format=None,
14941494
quotechar='"', line_terminator='\n', chunksize=None,
14951495
tupleize_cols=None, date_format=None, doublequote=True,
14961496
escapechar=None, decimal='.'):
1497-
r"""Write DataFrame to a comma-separated values (csv) file
1497+
"""Write a DataFrame to a comma-separated values (CSV) file.
1498+
1499+
Write a DataFrame to a comma-separated values (CSV) file with an user
1500+
specified format (e.g. a separator, missing values representation,
1501+
quoting etc.), header and index specification and possible compression.
14981502
14991503
Parameters
15001504
----------
1501-
path_or_buf : string or file handle, default None
1505+
path_or_buf : str or file handle, default None
15021506
File path or object, if None is provided the result is returned as
15031507
a string.
1504-
sep : character, default ','
1508+
sep : str (length 1), default ','
15051509
Field delimiter for the output file.
1506-
na_rep : string, default ''
1507-
Missing data representation
1508-
float_format : string, default None
1509-
Format string for floating point numbers
1510+
na_rep : str, default ''
1511+
Missing data representation.
1512+
float_format : str, default None
1513+
Format string for floating point numbers.
15101514
columns : sequence, optional
1511-
Columns to write
1512-
header : boolean or list of string, default True
1515+
Columns to write.
1516+
header : bool or list of str, default True
15131517
Write out the column names. If a list of strings is given it is
1514-
assumed to be aliases for the column names
1515-
index : boolean, default True
1516-
Write row names (index)
1517-
index_label : string or sequence, or False, default None
1518+
assumed to be aliases for the column names.
1519+
index : bool, default True
1520+
Write row names (index).
1521+
index_label : str or sequence, or False, default None
15181522
Column label for index column(s) if desired. If None is given, and
1519-
`header` and `index` are True, then the index names are used. A
1520-
sequence should be given if the DataFrame uses MultiIndex. If
1521-
False do not print fields for index names. Use index_label=False
1522-
for easier importing in R
1523-
mode : str
1524-
Python write mode, default 'w'
1525-
encoding : string, optional
1523+
`header` and `index` are `True`, then the index names are used. A
1524+
sequence should be given if the DataFrame uses MultiIndex. If
1525+
`False` do not print fields for index names.
1526+
Use `index_label=False` for easier importing in R.
1527+
mode : str, default 'w'
1528+
Python write mode.
1529+
encoding : str, optional
15261530
A string representing the encoding to use in the output file,
15271531
defaults to 'ascii' on Python 2 and 'utf-8' on Python 3.
1528-
compression : string, optional
1529-
a string representing the compression to use in the output file,
1530-
allowed values are 'gzip', 'bz2', 'xz',
1531-
only used when the first argument is a filename
1532-
line_terminator : string, default ``'\n'``
1532+
compression : str, optional
1533+
A string representing the compression to use in the output file,
1534+
allowed values are 'gzip', 'bz2', 'xz', only used when the first
1535+
argument is a filename.
1536+
line_terminator : str, default ``'\n'``
15331537
The newline character or character sequence to use in the output
15341538
file
15351539
quoting : optional constant from csv module
15361540
defaults to csv.QUOTE_MINIMAL. If you have set a `float_format`
15371541
then floats are converted to strings and thus csv.QUOTE_NONNUMERIC
15381542
will treat them as non-numeric
1539-
quotechar : string (length 1), default '\"'
1543+
quotechar : str (length 1), default '\"'
15401544
character used to quote fields
1541-
doublequote : boolean, default True
1545+
doublequote : bool, default True
15421546
Control quoting of `quotechar` inside a field
1543-
escapechar : string (length 1), default None
1547+
escapechar : str (length 1), default None
15441548
character used to escape `sep` and `quotechar` when appropriate
15451549
chunksize : int or None
15461550
rows to write at a time
1547-
tupleize_cols : boolean, default False
1551+
tupleize_cols : bool, default False
15481552
.. deprecated:: 0.21.0
15491553
This argument will be removed and will always write each row
15501554
of the multi-index as a separate row in the CSV file.
15511555
1552-
Write MultiIndex columns as a list of tuples (if True) or in
1556+
Write MultiIndex columns as a list of tuples (if `True`) or in
15531557
the new, expanded format, where each MultiIndex column is a row
1554-
in the CSV (if False).
1555-
date_format : string, default None
1558+
in the CSV (if `False`).
1559+
date_format : str, default None
15561560
Format string for datetime objects
1557-
decimal: string, default '.'
1561+
decimal: str, default '.'
15581562
Character recognized as decimal separator. E.g. use ',' for
15591563
European data
15601564
1565+
See Also
1566+
--------
1567+
pandas.Series.to_csv : Write a Series to a comma-separated values (CSV)
1568+
file.
1569+
pandas.read_csv : Read a comma-separated values (CSV) file into
1570+
a DataFrame.
15611571
"""
15621572

15631573
if tupleize_cols is not None:

0 commit comments

Comments
 (0)