使用python数据分析工具出错,single positional indexer is out-of-bounds

掌上鹅 学生  2017-11-07 10:05:09
第一次用这几个工具。就出现好几个错误。
源代码:
# line plot of time series

from pandas import Series

from matplotlib import pyplot

# load dataset

series = Series.from_csv('car-sales.csv', header=0)

# display first few rows

print(series.head(5))

# line plot of dataset

series.plot()

pyplot.show()
报错代码:
File "/home/mrgan/文档/python_work/date_ku/car_sales.py", line 9, in <module>
series = Series.from_csv('car-sales.csv', header=0)
File "/usr/lib/python2.7/dist-packages/pandas/core/series.py", line 2476, in from_csv
result = df.iloc[:,0]
File "/usr/lib/python2.7/dist-packages/pandas/core/indexing.py", line 1225, in __getitem__
return self._getitem_tuple(key)
File "/usr/lib/python2.7/dist-packages/pandas/core/indexing.py", line 1449, in _getitem_tuple
self._has_valid_tuple(tup)
File "/usr/lib/python2.7/dist-packages/pandas/core/indexing.py", line 127, in _has_valid_tuple
if not self._has_valid_type(k, i):
File "/usr/lib/python2.7/dist-packages/pandas/core/indexing.py", line 1417, in _has_valid_type
return self._is_valid_integer(key, axis)
File "/usr/lib/python2.7/dist-packages/pandas/core/indexing.py", line 1431, in _is_valid_integer
raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds
...全文
3743 2 点赞 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
cuoguo_xin 2018-07-29
这个是内存超出了最大值,你把header=0去掉试试
  • 打赏
  • 举报
回复
相关推荐
发帖
脚本语言
加入

3.7w+

社区成员

JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
申请成为版主
帖子事件
创建了帖子
2017-11-07 10:05
社区公告

CSDN 脚本语言社区接受专栏投稿(专栏会在顶部创建专属你的栏目),投稿需满足以下要求:

  • 脚本语言技术相关;
  • 文章持续更新,保持活跃;
  • 内容清晰明了,干货为主;
  • 文章排版有序,有条有理。

本社区开通招聘专栏,发布招聘信息请联系版主,发布者需要保证招聘信息真实有效,CSDN 平台和版主不对招聘内容负责!

联系方式:私聊版主、发送邮件、QQ联系等均可: