CBSE Class 12 Informatics Practices Question 8 of 16

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.

Get the Bright Tutorials app Stuck on a question? Ask Bright Buddy — your AI tutor — for step-by-step help in the app.