pandas.Series.from_csv
-
classmethod Series.from_csv(path, sep=', ', parse_dates=True, header=None, index_col=0, encoding=None, infer_datetime_format=False)
[source] -
Read CSV file.
Deprecated since version 0.21.0: Use
pandas.read_csv()
instead.It is preferable to use the more powerful
pandas.read_csv()
for most general purposes, butfrom_csv
makes for an easy roundtrip to and from a file (the exact counterpart ofto_csv
), especially with a time Series.This method only differs from
pandas.read_csv()
in some defaults:-
index_col
is0
instead ofNone
(take first column as index by default) -
header
isNone
instead of0
(the first row is not used as the column names) -
parse_dates
isTrue
instead ofFalse
(try parsing the index as datetime by default)
With
pandas.read_csv()
, the optionsqueeze=True
can be used to return a Series likefrom_csv
.Parameters: -
path : string file path or file handle / StringIO
sep : string, default ‘,’
Field delimiter
parse_dates : boolean, default True
Parse dates. Different default from read_table
header : int, default None
Row to use as header (skip prior rows)
index_col : int or sequence, default 0
Column to use for index. If a sequence is given, a MultiIndex is used. Different default from read_table
encoding : string, optional
a string representing the encoding to use if the contents are non-ascii, for python versions prior to 3
infer_datetime_format: boolean, default False
If True and
parse_dates
is True for a column, try to infer the datetime format based on the first datetime string. If the format can be inferred, there often will be a large parsing speed-up.Returns: -
y : Series
See also
-
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.Series.from_csv.html