@@ -180,7 +180,6 @@ class DataFrame(NDFrame):
180
180
--------
181
181
DataFrame.from_records : constructor from tuples, also record arrays
182
182
DataFrame.from_dict : from dicts of Series, arrays, or dicts
183
- DataFrame.from_csv : from CSV files
184
183
DataFrame.from_items : from sequence of (key, value) pairs
185
184
pandas.read_csv, pandas.read_table, pandas.read_clipboard
186
185
"""
@@ -1052,13 +1051,29 @@ def from_csv(cls, path, header=0, sep=',', index_col=0,
1052
1051
parse_dates = True , encoding = None , tupleize_cols = False ,
1053
1052
infer_datetime_format = False ):
1054
1053
"""
1055
- Read delimited file into DataFrame
1054
+ Read CSV file (DISCOURAGED, please use :func:`pandas.read_csv` instead).
1055
+
1056
+ It is preferable to use the more powerful :func:`pandas.read_csv`
1057
+ for most general purposes, but ``from_csv`` makes for an easy
1058
+ roundtrip to and from a file (the exact counterpart of
1059
+ ``to_csv``), especially with a DataFrame of time series data.
1060
+
1061
+ This method only differs from the preferred :func:`pandas.read_csv`
1062
+ in some defaults:
1063
+
1064
+ - `index_col` is ``0`` instead of ``None`` (take first column as index
1065
+ by default)
1066
+ - `parse_dates` is ``True`` instead of ``False`` (try parsing the index
1067
+ as datetime by default)
1068
+
1069
+ So a ``pd.DataFrame.from_csv(path)`` can be replaced by
1070
+ ``pd.read_csv(path, index_col=0, parse_dates=True)``.
1056
1071
1057
1072
Parameters
1058
1073
----------
1059
1074
path : string file path or file handle / StringIO
1060
1075
header : int, default 0
1061
- Row to use at header (skip prior rows)
1076
+ Row to use as header (skip prior rows)
1062
1077
sep : string, default ','
1063
1078
Field delimiter
1064
1079
index_col : int or sequence, default 0
@@ -1074,15 +1089,14 @@ def from_csv(cls, path, header=0, sep=',', index_col=0,
1074
1089
datetime format based on the first datetime string. If the format
1075
1090
can be inferred, there often will be a large parsing speed-up.
1076
1091
1077
- Notes
1078
- -----
1079
- Preferable to use read_table for most general purposes but from_csv
1080
- makes for an easy roundtrip to and from file, especially with a
1081
- DataFrame of time series data
1092
+ See also
1093
+ --------
1094
+ pandas.read_csv
1082
1095
1083
1096
Returns
1084
1097
-------
1085
1098
y : DataFrame
1099
+
1086
1100
"""
1087
1101
from pandas .io .parsers import read_table
1088
1102
return read_table (path , header = header , sep = sep ,
0 commit comments