我正在尝试将数据框插入到 sql 表中,但出现以下错误
ProgrammingError: (pyodbc.ProgrammingError) ('Unknown object type numpy.ndarray during describe', 'HY000')
对于以下代码
merged.to_sql('pmg.cwc.EmSignals1', engine, chunksize=1000,
if_exists='replace',
index=False,
dtype ={'monthenddate': sqlalchemy.types.NVARCHAR(length=20),
'lastweekday': sqlalchemy.types.NVARCHAR(length=20),
'item': sqlalchemy.types.NVARCHAR(length=20),
'sols': sqlalchemy.types.NVARCHAR(length=20),
'value': sqlalchemy.types.NVARCHAR(length=20)})
这是数据框的 .head
monthenddate lastweekday 项目 sols 值
0 1999-12-31 1999-12-31 值 2W063W1 -0.870225
1 1999-12-31 1999-12-31 值 W1YBRK4 0.078154
2 1999-12-31 1999-12-31 值 X16W902 -0.072731
3 1999-12-31 1999-12-31 值 2X45X4W 1.278582
4 1999-12-31 1999-12-31 值 23X1XWX 0.293649
我已经尝试了很多,但无法找出问题的原因。