简体   繁体   English

无法使用 Pandas 将 csv 文件加载到 sql server

[英]Uable to load csv file using pandas into sql server

I am new to pandas and I want to load a csv file into sql server.我是熊猫的新手,我想将一个 csv 文件加载到 sql server 中。

I am able to read csv file.我能够读取 csv 文件。 But while trying to load into sql server I am getting error as "No such column in target named as [index].While trying to run debugger in pycharm also, could see my to_SQL query as但是在尝试加载到 sql server 时,我收到错误消息“目标中没有名为 [index] 的列。同时尝试在 pycharm 中运行调试器时,可以看到我的 to_SQL 查询为

INSERT INTO <target> (index,[0],[1],....) values (?,?,?..)

I have tried to remove index from dataframe but still issue exists.我试图从数据框中删除索引,但问题仍然存在。 Kindly advise好心提醒

Can you try add the index=False option in your function?您可以尝试在函数中添加 index=False 选项吗? If you are using df.to_sql, it'll be something like:如果您使用的是 df.to_sql,它将类似于:

df.to_sql(index=False,...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM