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