【发布时间】:2017-08-25 07:10:28
【问题描述】:
此代码在安装 scipy 之前“收集”了我所有的文本数据:
#load a list with the filenames in root folder with .Spectrum extensions, stripping only the absorbance values
Spectral_Output = []
for file in glob.glob("*.Spectrum"):
Spectral_Output.append(
numpy.loadtxt(file, skiprows=1, usecols=(1)))
#convert to a numpy array and print dimensions
spectral_data = numpy.asarray(Spectral_Output)
print(spectral_data.shape)
#take only column 26 or the values for 2268; print stuff
Absorbance2268 = spectral_data[:, 25]
然后我想在另一个浓度数组上运行回归 stats.linregress(x,y),所以我安装了 Scipy。
由于某种原因 pip 不会在 Windows 上安装 scipy,所以我安装了 numpy-1.11.3+mkl-cp27-cp27m-win32.whl 和 scipy-0.19.0-cp27-cp27m-win32.whl 从这里:http://www.lfd.uci.edu/~gohlke/pythonlibs/ 由 scipy 的网站推荐
现在,代码抛出了这个错误:
Traceback (most recent call last):
File "C:\Spectrometer\Spectrometer\0330\Spectrum.py", line 31, in <module>
numpy.loadtxt(file, skiprows=1, usecols=(1)))
File "C:\Python27\lib\site-packages\numpy\lib\npyio.py", line 790, in loadtxt
usecols = list(usecols)
TypeError: 'int' object is not iterable
我太不合群了。任何帮助将不胜感激。
【问题讨论】:
标签: windows python-2.7 numpy scipy