@@ -1710,103 +1710,6 @@ def to_panel(self):
1710
1710
1711
1711
return self ._constructor_expanddim (new_mgr )
1712
1712
1713
- def to_csv (self , path_or_buf = None , sep = "," , na_rep = '' , float_format = None ,
1714
- columns = None , header = True , index = True , index_label = None ,
1715
- mode = 'w' , encoding = None , compression = None , quoting = None ,
1716
- quotechar = '"' , line_terminator = '\n ' , chunksize = None ,
1717
- tupleize_cols = None , date_format = None , doublequote = True ,
1718
- escapechar = None , decimal = '.' ):
1719
- r"""Write DataFrame to a comma-separated values (csv) file
1720
-
1721
- Parameters
1722
- ----------
1723
- path_or_buf : string or file handle, default None
1724
- File path or object, if None is provided the result is returned as
1725
- a string.
1726
- sep : character, default ','
1727
- Field delimiter for the output file.
1728
- na_rep : string, default ''
1729
- Missing data representation
1730
- float_format : string, default None
1731
- Format string for floating point numbers
1732
- columns : sequence, optional
1733
- Columns to write
1734
- header : boolean or list of string, default True
1735
- Write out the column names. If a list of strings is given it is
1736
- assumed to be aliases for the column names
1737
- index : boolean, default True
1738
- Write row names (index)
1739
- index_label : string or sequence, or False, default None
1740
- Column label for index column(s) if desired. If None is given, and
1741
- `header` and `index` are True, then the index names are used. A
1742
- sequence should be given if the DataFrame uses MultiIndex. If
1743
- False do not print fields for index names. Use index_label=False
1744
- for easier importing in R
1745
- mode : str
1746
- Python write mode, default 'w'
1747
- encoding : string, optional
1748
- A string representing the encoding to use in the output file,
1749
- defaults to 'ascii' on Python 2 and 'utf-8' on Python 3.
1750
- compression : {'infer', 'gzip', 'bz2', 'xz', None}, default None
1751
- If 'infer' and `path_or_buf` is path-like, then detect compression
1752
- from the following extensions: '.gz', '.bz2' or '.xz'
1753
- (otherwise no compression).
1754
- line_terminator : string, default ``'\n'``
1755
- The newline character or character sequence to use in the output
1756
- file
1757
- quoting : optional constant from csv module
1758
- defaults to csv.QUOTE_MINIMAL. If you have set a `float_format`
1759
- then floats are converted to strings and thus csv.QUOTE_NONNUMERIC
1760
- will treat them as non-numeric
1761
- quotechar : string (length 1), default '\"'
1762
- character used to quote fields
1763
- doublequote : boolean, default True
1764
- Control quoting of `quotechar` inside a field
1765
- escapechar : string (length 1), default None
1766
- character used to escape `sep` and `quotechar` when appropriate
1767
- chunksize : int or None
1768
- rows to write at a time
1769
- tupleize_cols : boolean, default False
1770
- .. deprecated:: 0.21.0
1771
- This argument will be removed and will always write each row
1772
- of the multi-index as a separate row in the CSV file.
1773
-
1774
- Write MultiIndex columns as a list of tuples (if True) or in
1775
- the new, expanded format, where each MultiIndex column is a row
1776
- in the CSV (if False).
1777
- date_format : string, default None
1778
- Format string for datetime objects
1779
- decimal: string, default '.'
1780
- Character recognized as decimal separator. E.g. use ',' for
1781
- European data
1782
-
1783
- """
1784
-
1785
- if tupleize_cols is not None :
1786
- warnings .warn ("The 'tupleize_cols' parameter is deprecated and "
1787
- "will be removed in a future version" ,
1788
- FutureWarning , stacklevel = 2 )
1789
- else :
1790
- tupleize_cols = False
1791
-
1792
- from pandas .io .formats .csvs import CSVFormatter
1793
- formatter = CSVFormatter (self , path_or_buf ,
1794
- line_terminator = line_terminator , sep = sep ,
1795
- encoding = encoding ,
1796
- compression = compression , quoting = quoting ,
1797
- na_rep = na_rep , float_format = float_format ,
1798
- cols = columns , header = header , index = index ,
1799
- index_label = index_label , mode = mode ,
1800
- chunksize = chunksize , quotechar = quotechar ,
1801
- tupleize_cols = tupleize_cols ,
1802
- date_format = date_format ,
1803
- doublequote = doublequote ,
1804
- escapechar = escapechar , decimal = decimal )
1805
- formatter .save ()
1806
-
1807
- if path_or_buf is None :
1808
- return formatter .path_or_buf .getvalue ()
1809
-
1810
1713
@Appender (_shared_docs ['to_excel' ] % _shared_doc_kwargs )
1811
1714
def to_excel (self , excel_writer , sheet_name = 'Sheet1' , na_rep = '' ,
1812
1715
float_format = None , columns = None , header = True , index = True ,
0 commit comments