I am reading a table from my sql server with Pandas such as
df= pd.read_sql('table1', engine)
where engine is my pyodbc connection and then again I am pushing it to sql server
df.to_sql('table2', engine, if_exists='replace')
which gives me an error
ValueError: duplicate name in index/columns: cannot insert level_0, already exists
and when I try to drop the column, it gave me some another error, which is anyways not an efficient way. I tried this as well, which also didn't work
df= df.reset_index(drop=True)
Every help will be important
index=Flasewhile wrtingto_sqlbecause index values should be unique.