加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – 无法导入Pandas:TypeError

发布时间:2020-12-20 11:38:30 所属栏目:Python 来源:网络整理
导读:我想使用以下pandas,但根本无法导入它. https://github.com/pydata/pandas/releases/download/v0.15.0/pandas-0.15.0.win-amd64-py2.7.exe 但是我无法导入它: import pandas as pdTraceback (most recent call last): File "pyshell#0",line 1,in module im
我想使用以下pandas,但根本无法导入它.

https://github.com/pydata/pandas/releases/download/v0.15.0/pandas-0.15.0.win-amd64-py2.7.exe

但是我无法导入它:

import pandas as pd

Traceback (most recent call last):
  File "<pyshell#0>",line 1,in <module>
    import pandas as pd
  File "C:Python27libsite-packagespandas__init__.py",line 45,in <module>
    from pandas.io.api import *
  File "C:Python27libsite-packagespandasioapi.py",line 15,in <module>
    from pandas.io.gbq import read_gbq
  File "C:Python27libsite-packagespandasiogbq.py",line 39,in <module>
    if LooseVersion(_GOOGLE_API_CLIENT_VERSION >= '1.2.0'):
  File "C:Python27libdistutilsversion.py",line 265,in __init__
    self.parse(vstring)
  File "C:Python27libdistutilsversion.py",line 274,in parse
    self.component_re.split(vstring))
TypeError: expected string or buffer

怎么了?

解决方法

将google-api-python-client升级到高于1.2.0的版本时,我发生了这种情况.
问题出在Pandas上,但它已修复: https://github.com/pydata/pandas/commit/403f38da35ab04d3997f61db3c98134fe02910d3

解决方案是降级google-api-python-client,自行修复pandas中的行或等待pandas 0.15.1

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读