Python super(type,obj):obj必须是pandas中type的实例或子类型
我使用以下方法从python中的Sql中提取数据:Python super(type,obj):obj必须是pandas中type的实例或子类型,python,super,Python,Super,我使用以下方法从python中的Sql中提取数据: df_sql = pd.read_sql_query('select * from table', conn) 到目前为止,它一直运作良好。今天,当我使用pip安装其他软件包时,我的pandas也被重新安装/更新了 pd.__version__ Out[8]: '0.22.0' 现在,当我运行上述代码时,我得到一个错误: File "C:\xxx\xxx\xxxx\xx\Continuum\anaconda3\lib\site-pack
df_sql = pd.read_sql_query('select * from table', conn)
到目前为止,它一直运作良好。今天,当我使用pip安装其他软件包时,我的pandas也被重新安装/更新了
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
我甚至试图通过以下链接中的步骤来解决这个问题。还在出错吗
完全错误:
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
df\u sql=pd.read\u sql\u查询('select*from table',conn)
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
df_sql=pd.read_sql_查询('select*from table',conn)
文件“C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site packages\pandas\io\sql.py”,第332行,在read\u sql\u查询中
解析日期=解析日期,chunksize=chunksize)
读取查询中的文件“C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site packages\pandas\io\sql.py”,第1458行
解析_日期=解析_日期)
文件“C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site packages\pandas\io\sql.py”,第157行,在结果中
强制浮动=强制浮动)
文件“C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site packages\pandas\core\frame.py”,第1093行,在from\U记录中
列=_确保_索引(列)
文件“C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site packages\pandas\core\index\base.py”,第4212行,在索引中
定义获取值(数据类型):
文件“C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site packages\pandas\core\index\base.py”,第205行,新__
如果是间隔类型(数据):
文件“C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site packages\pandas\core\dtypes\common.py”,第475行,在is\U interval\U dtype中
返回IntervalDtype.is\u dtype(arr\u或\u dtype)
文件“C:\xxx\xxxx\xxx\Local\Continuum\anaconda3\lib\site packages\pandas\core\dtypes\dtypes.py”,第696行,在is\U dtype中
return super(IntervalDtype,cls)。is_dtype(dtype)
TypeError:super(type,obj):obj必须是类型的实例或子类型
如果运行import sys,您会得到什么输出;打印(sys.version)?另外,请发布完整的堆栈跟踪。不要删节。3.6.4 | Anaconda,Inc.|(默认值,2018年1月16日,10:22:32)[MSC v.1900 64位(AMD64)]我添加了完整的错误。如果熊猫的功能副本正常,则不可能进行堆栈跟踪。看起来你可能不知怎么地腐蚀了熊猫。关闭Python,卸载pandas,然后重新安装。