super(type,obj):obj必须是pandas中type的实例或子类型

时间:2019-05-28 06:14:14

标签: python super

我正在使用以下命令从python中的Sql中提取数据:

df_sql = pd.read_sql_query('select * from table', conn)

到目前为止运行良好。今天,当我使用pip install安装其他软件包时,我的熊猫也被重新安装/更新了。

pd.__version__
Out[8]: '0.22.0'

现在,当我运行上面的代码时,我得到了错误:

  File "C:\xxx\xxx\xxxx\xx\Continuum\anaconda3\lib\site-packages\pandas\core\dtypes\dtypes.py", line 697, in is_dtype
    #        return super(IntervalDtype, cls).all()

TypeError: super(type, obj): obj must be an instance or subtype of type

我什至尝试通过以下提到的链接中的步骤来解决此问题。仍然出现错误

super(type, obj): obj must be an instance or subtype of type

完全错误:

df_sql = pd.read_sql_query('select * from table', conn)
Traceback (most recent call last):

  File "<ipython-input-9-f26429b805cd>", line 1, in <module>
    df_sql = pd.read_sql_query('select * from table', conn)

  File "C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py", line 332, in read_sql_query
    parse_dates=parse_dates, chunksize=chunksize)

  File "C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py", line 1458, in read_query
    parse_dates=parse_dates)

  File "C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site-packages\pandas\io\sql.py", line 157, in _wrap_result
    coerce_float=coerce_float)

  File "C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site-packages\pandas\core\frame.py", line 1093, in from_records
    columns = _ensure_index(columns)

  File "C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site-packages\pandas\core\indexes\base.py", line 4212, in _ensure_index
    def _get_na_value(dtype):

  File "C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site-packages\pandas\core\indexes\base.py", line 205, in __new__
    if is_interval_dtype(data):

  File "C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site-packages\pandas\core\dtypes\common.py", line 475, in is_interval_dtype
    return IntervalDtype.is_dtype(arr_or_dtype)

  File "C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site-packages\pandas\core\dtypes\dtypes.py", line 696, in is_dtype
    return super(IntervalDtype, cls).is_dtype(dtype)

TypeError: super(type, obj): obj must be an instance or subtype of type

0 个答案:

没有答案