pandas.DataFrame.to_csv
-
to_csv精度设置
df_data.to_csv(outfile, index=False,header=False, float_format='%.3f')
DataFrame.
to_csv
(
path_or_buf=None,
sep=’,
’,
na_rep=”,
float_format=None,
columns=None,
header=True,
index=True,
index_label=None,
mode=’w’,
encoding=None,
compression=None,
quoting=None,
quotechar=’”’,
line_terminator=’\n’,
chunksize=None,
tupleize_cols=False,
date_format=None,
doublequote=True,
escapechar=None,
decimal=’.’
)
[source]
Parameters: | path_or_buf : string or file handle, default None
sep : character, default ‘,’
na_rep : string, default ”
float_format : string, default None
columns : sequence, optional
header : boolean or list of string, default True
index : boolean, default True
index_label : string or sequence, or False, default None
mode : str
encoding : string, optional
compression : string, optional
line_terminator : string, default
quoting : optional constant from csv module
quotechar : string (length 1), default ‘”’
doublequote : boolean, default True
escapechar : string (length 1), default None
chunksize : int or None
tupleize_cols : boolean, default False
date_format : string, default None
decimal: string, default ‘.’
|
---|