您的位置:首页 > 移动开发

读取csv文件并使用pandas.Series.apply进行处理时,对header=?的处理

2017-10-10 22:10 921 查看
使用pandas.Series.apply可以编写函数,对Dataframe中的每一个Series进行处理,其用法如下:
http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.apply.html 
然而,dataframe在读取Series时,会不可避免的带上column名字(如这里的Date_received),

使得apply函数出错。

解决方法,是在读取的时候,将 header
= None 改为 header
=
0  即可

  header=0 denotes the first line of data rather than
the first line of the file.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: