pandas: powerful Python data analysis toolkit

pandas.read_csv

pandas.read_csv(filepath_or_buffersep=''delimiter=Noneheader='infer'names=Noneindex_col=Noneusecols=Nonesqueeze=Falseprefix=Nonemangle_dupe_cols=Truedtype=Noneengine=Noneconverters=Nonetrue_values=Nonefalse_values=Noneskipinitialspace=Falseskiprows=Nonenrows=Nonena_values=Nonekeep_default_na=Truena_filter=Trueverbose=Falseskip_blank_lines=Trueparse_dates=Falseinfer_datetime_format=Falsekeep_date_col=Falsedate_parser=Nonedayfirst=Falseiterator=Falsechunksize=Nonecompression='infer'thousands=Nonedecimal='.'lineterminator=Nonequotechar='"'quoting=0escapechar=Nonecomment=Noneencoding=Nonedialect=Nonetupleize_cols=Falseerror_bad_lines=Truewarn_bad_lines=Trueskipfooter=0skip_footer=0doublequote=Truedelim_whitespace=Falseas_recarray=Falsecompact_ints=Falseuse_unsigned=Falselow_memory=Truebuffer_lines=Nonememory_map=Falsefloat_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

 

转载于:https://www.cnblogs.com/dreamafar/p/6227576.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值