CBSE Class 12 Informatics Practices Question 5 of 70

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

Back to all questions
5
Question

Question 5

Assertion. A DataFrame's data can be exported as a table of a mysql database.

Reason. Over an established connection to a mysql database, <DF>.to_sql() would write the data of the DataFrame <DF> as a table in the mysql database.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.
Answer

Both A and R are true and R is the correct explanation of A.

Explanation
In Pandas, a DataFrame's data can be exported as a table of a mysql database. Over an established connection to a mysql database, the DF.to_sql() method is used to write the data of the DataFrame DF as a table in the mysql database.