在WinPython中读取CSV文件

时间:2016-11-08 09:39:16

标签: python csv pandas

我想在Spyder中合并两个CSV文件,

import pandas as pd
data1 = pd.readcsv('C:/Rdata/plant1.csv')
data2 = pd.readcsv('C:/Rdata/Species.csv')
newdata = pd.merge(data1, data2, on='Speies')

但得到了这个错误:

………………………………, line 9, in <module>
data1 = pd.readcsv('C:/Rdata/plant1.csv')
AttributeError: 'module' object has no attribute 'readcsv'

如何解决此问题?

1 个答案:

答案 0 :(得分:1)

显然,没有任何名为&#39; readcsv&#39;的功能。这是read_csv.

import pandas as pd
data1 = pd.read_csv('C:/Rdata/plant1.csv')
data2 = pd.read_csv('C:/Rdata/Species.csv')
newdata = pd.merge(data1, data2, on='Speies')