Python TypeError:使用Pandas的预期字符串或缓冲区

时间:2017-07-19 23:29:27

标签: python pandas ubuntu-14.04

我正在尝试运行Python脚本以从Excel文件中提取某些列。

我发现Pandas可能是一个很好的解决方案,所以我尝试使用以下代码:

import pandas

for filename in InFileslist:
    fields = ['MRN']
    df = pandas.read_excel(filename, skipinitialspace=True, usecols=fields)
    print df.keys()
    print df.MRN

以下是我收到的错误消息。

Traceback (most recent call last):
  File "/home/FetchingData_v3.py", line 10, in <module>
    import pandas
  File "/usr/local/lib/python2.7/dist-packages/pandas/__init__.py", line 45, in <module>
    from pandas.io.api import *
  File "/usr/local/lib/python2.7/dist-packages/pandas/io/api.py", line 15, in <module>
    from pandas.io.gbq import read_gbq
  File "/usr/local/lib/python2.7/dist-packages/pandas/io/gbq.py", line 52, in <module>
    if LooseVersion(_GOOGLE_FLAGS_VERSION >= '2.0.0'):
  File "/usr/lib/python2.7/distutils/version.py", line 265, in __init__
self.parse(vstring)
  File "/usr/lib/python2.7/distutils/version.py", line 274, in parse
self.component_re.split(vstring))
TypeError: expected string or buffer

我不确定这是否与Pandas安装问题或代码问题有关。

0 个答案:

没有答案