CBSE Class 12 Informatics Practices
Question 70 of 70
Importing/Exporting Data between CSV Files/MySQL and Pandas — Question 7
Back to all questions 7
Question The sales table of company database of MySQL stores the sales records of 100 salesmen. Write a program to load only those records in DataFrame which have made sales more than of 50000/-.
import pandas as pd
import mysql.connector as sqltor
mycon = sqltor.connect(host = "localhost", user = "root", passwd = "mypass", database = "company")
df = pd.read_sql("SELECT * FROM sales WHERE Sales > 50000;", mycon)
print(df)