Python Pandas错误标记数据 [英] Python Pandas Error tokenizing data

查看:476
本文介绍了Python Pandas错误标记数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Pandas来操纵.csv文件,但我得到这个错误:

  pandas.parser.CParserError:对数据进行标记化时出错。 C错误:第3行中的2个字段,看到12 



我试着阅读Pandas文档,

  path = 'GOOG Key Ratios.csv'
#print(open(path).read())
data = pd.read_csv(path)

我如何解决这个问题?我应该使用csv模块还是其他语言?



感谢伙伴。



文件来自晨星

解决方案

您也可以尝试;

  data = pd.read_csv .csv',error_bad_lines = False)


I try to use Pandas to manipulate a .csv files but I get this error:

pandas.parser.CParserError: Error tokenizing data. C error: Expected 2 fields in line 3,  saw 12

I have tried to read the Pandas doc, but found nothing.

My code is simple:

path = 'GOOG Key Ratios.csv'
#print(open(path).read())
data = pd.read_csv(path)

How can I resolve this ? Should I use the csv module or an other langage ?

Thanks folks.

File is from Morningstar

解决方案

you could also try;

data = pd.read_csv('file1.csv', error_bad_lines=False)

这篇关于Python Pandas错误标记数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆