CBSE Class 12 Informatics Practices Question 35 of 70

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

Back to all questions
16
Question

Question 16

To append the content of DataFrame in a table of MySQL, ............... argument is used in to_sql().

  1. if_exists = "Add"
  2. if_exists = "append"
  3. if_exists = Add
  4. if_exists = append
Answer

if_exists = "append"

Reason — The if_exists = "append" argument in to_sql() is used to append the content of a DataFrame to an existing table in MySQL. This ensures that the data from the DataFrame is added to the specified table without overwriting or deleting any existing data.