简体   繁体   中英

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.

I am able to read csv file. 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

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? If you are using df.to_sql, it'll be something like:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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