CBSE Class 12 Informatics Practices
Question 56 of 70
Importing/Exporting Data between CSV Files/MySQL and Pandas — Question 11
Back to all questionsLet query store the following SQL statement:
query = "SELECT * FROM EMPLOYEE WHERE department = 'Human Resource'"import pandas as pd
import mysql.connector as sqltor
mycon = sqltor.connect(host = "localhost",
user = "root",
passwd = "MyPass",
database = "Mydata")
query = "SELECT * FROM EMPLOYEE WHERE department = 'Human Resource'"
mdf = pd.read_sql(query, mycon)
print(mdf)
mycon.close()