pandas: powerful Python data analysis toolkit
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pandas: powerful Python data analysis toolkit相关的知识,希望对你有一定的参考价值。
pandas.read_csv
pandas.
read_csv
(filepath_or_buffer, sep=‘, ‘, delimiter=None, header=‘infer‘, names=None, index_col=None, usecols=None, squeeze=False, prefix=None, mangle_dupe_cols=True, dtype=None, engine=None, converters=None, true_values=None, false_values=None, skipinitialspace=False, skiprows=None, nrows=None, na_values=None, keep_default_na=True, na_filter=True, verbose=False, skip_blank_lines=True, parse_dates=False, infer_datetime_format=False, keep_date_col=False, date_parser=None, dayfirst=False, iterator=False, chunksize=None, compression=‘infer‘, thousands=None, decimal=‘.‘, lineterminator=None, quotechar=‘"‘, quoting=0, escapechar=None, comment=None, encoding=None, dialect=None, tupleize_cols=False, error_bad_lines=True, warn_bad_lines=True, skipfooter=0, skip_footer=0, doublequote=True, delim_whitespace=False, as_recarray=False, compact_ints=False, use_unsigned=False, low_memory=True, buffer_lines=None, memory_map=False, float_precision=None)[source]
Read CSV (comma-separated) file into DataFrame
dataframe = pandas.read_csv(‘water_demand2009.csv‘,header =None, usecols=None, engine=‘python‘, skipfooter=0)
Parameters:
filepath_or_buffer : str, pathlib.Path, py._path.local.LocalPath or any object with a read() method (such as a file handle or StringIO)
header : int or list of ints, default ‘infer’
- Row number(s) to use as the column names, and the start of the data. Default behavior is as if set to 0 if no names passed, otherwise None.
usecols : array-like, default None
- Return a subset of the columns. All elements in this array must either be positional (i.e. integer indices into the document columns) or strings that correspond to column names provided either by the user in names or inferred from the document header row(s). For example, a valid usecols parameter would be [0, 1, 2] or [‘foo’, ‘bar’, ‘baz’]. Using this parameter results in much faster parsing time and lower memory usage.
engine : {‘c’, ‘python’}, optional
- Parser engine to use. The C engine is faster while the python engine is currently more feature-complete.
skipfooter : int, default 0
- Number of lines at bottom of file to skip (Unsupported with engine=’c’)
Returns: result : DataFrame or TextParser
以上是关于pandas: powerful Python data analysis toolkit的主要内容,如果未能解决你的问题,请参考以下文章