Pandas to_sql insert only some columns I am new using pandas. 
I am asking about how to insert specific columns using to_sql. 

This is my explanation.

I have a database with a table datasiswa with columns:


id: as int, with autoincrement, as primary key
name: string
age: string


And I have an excel file with header name and age.

How to use to_sql to insert in fields name and age only, without ids.
You'll need to perform two steps:


You get ride of the id column in the pandas dataframe:

df=df.drop(columns=['id'])

Add the index=False param: to the .to_sql() method:

selected.to_sql('dataiswa', engine, index=False)