我的熊猫有问题。首先,我尝试在cd C:\ Python27 \ Scrips ......上轻松安装。 easy_install.exe numpy
和easy_install.exe pandas
,但只有numpy工作,大熊猫没有,所以我用pip安装。它对两者都有效。但回到我的代码,当我测试它时,
继承我的代码:
import fileinput
import csv
import numpy
import pandas
#records = pe.iget_records(file_name="test.xlxs")
records = pd.read_csv('test.csv', header=None, nrows=5)
#To Write ni
cho = raw_input("\nStart Forecaster on file?:<1/0>")
if cho == 1:
for record in records:
rem = df.iloc([i], [0])
print(rem)
sold1 = df.iloc([i], [1])
print(sold1)
sold2 = df.iloc([i], [2])
print(sold2)
rem = int(rem)
sold1 = int(sold1)
sold2 = int(sold2)
result = forecast(rem,sold1,sold2)
print(result)
df.set_value([i], [4], result)
pd.to_csv('test.csv')
print "Forecast Complete! Please check the file!"
else:
quit()
但是我收到了这个错误:
Traceback (most recent call last):
File "tester.py", line 4, in <module>
import pandas
File "C:\Python27\lib\site-packages\pandas\__init__.py", line 25, in <module>
from pandas import hashtable, tslib, lib
File "pandas\src\numpy.pxd", line 157, in init pandas.hashtable (pandas\hashtable.c:40866)
ValueError: numpy.dtype has the wrong size, try recompiling. Expected 52, got 56
答案 0 :(得分:0)
您需要删除以前安装的pandas
和numpy
,因为您连续安装了太多次,导致库混淆。删除后,使用pandas
重新安装numpy
和pip
,如下所示:
pip install numpy
pip install pandas