PYTHON
Q1. Create and display a DataFrame from a 2D dictionary, Sales, which stores the quarter-wise sales as inner
dictionary for two years, as shown below:-
3
Sales= {‘yr1’ : { ‘Qtr1’: 34500, ‘Qtr2’: 56000, ‘Qtr3’: 47000, ‘Qtr4’:49000 } ,
‘yr2’ : { ‘Qtr1’: 44900, ‘Qtr2’: 46100, ‘Qtr3’: 57000, ‘Qtr4’: 59000}}
Q2. Write a program to create a DataFrame from a 2D array as shown below: 3
101 113 124
130 140 200
115 216 217
Q3. Marks is a list that stores marks of a student in 10 unit tests. Write a program to plot the student’s
performance in these 10 unit tests. 2
Weeks 1 2 3 4 5 6 7 8 9 10
Marks 12 10 10 15 17 25 12 22 35 40
B. SQL
Q1. Create a table Student tablegiven below:-
Studentid Name Marks
101 Rohit 410
102 Mohit 425
103 Rahul 475
104 Virat 495
i. Create a student table with the student id as varchar(10), name as varchar(30), and marks as integer(5)attributes
where the student id is the primary key. 2
ii. Insert the details of student in the above table as given. 2
iii. Find the min, max, sum, and average of the marks in the student table 2
iv. Use the select command to get the details of the students with marks more than 450 1
SOLUTIONS
A1.
A2.
A3.
SQL (I,ii,iii,iv)
select * from student where marks> 450;