CBSE Class 12 Informatics Practices Question 55 of 70

Importing/Exporting Data between CSV Files/MySQL and Pandas — Question 10

Back to all questions
10
Question

Question 10

What additional argument do you need to specify in to_sql() so that old data of MySQL table is retained ?

Answer

The if_exists argument in the pandas to_sql() function retains old data in a MySQL table. Using if_exists = append appends new data without deleting existing data.