You are on page 1of 3

SET-1

1. Write a program to create a DataFrame to store weight, age, name of 5 people. 2+3=5
(a) Print the DataFrame and its Transpose.
(b) Display the last two rows of Datframe
(c) Display the first two columns of DataFrame
2. KV Tezpur celebrated volunteering week where each section of class XI dedicated a day for 3
collecting amount for charity being supported by the school. A volunteered on Monday,B on
Tuesday,C on Wednesday and so on. There are six sections in class XI. Amount collected by
section A to F are 8000,1200,9800,11200,155500,7300.
Write a program to create a bar chart showing collection amount. The graph should
have proper and axes titles.
3. Create a table and Write SQL commands for the following on the basis of given table STUDENT. 2+5=7

Roll Name Stipend Stream AvgMark Grade Class


100 Ram 400.00 Medical 78.5 B 12B
200 Shyam 450.00 Commerc 89.2 A 11C
e
300 Mohan 300.00 Commerc 68.6 C 12C
e
400 Arun 350.00 Humanitie 73.1 B 12C
s
500 Sabina 500.00 Nonmedic 90.1 A 11A
al
600 John 400.00 Medical 75.4 B 12B
700 Robert 250.00 Humanitie 64.4 C 11A
s
800 Rubina 450.00 Nonmedic 88.5 A 12A
al
900 Abdul 500.00 Nonmedic 92.0 A 12A
al
1000 Tom 300.00 Commerc 67.5 C 12C
e

a. Select all the Nonmedical stream students from STUDENT.


b. List the names of those students who are in class 12..
c. List all the students sorted by AvgMark in descending order.
d. To display total Stipend on the basis of class.
e. To display the details of students which name stared with “ A”.
SET-2

1. Create the following DataFrame Sales containing year wise sales figures for five salespersons 2+3
in INR.Use the years as column labels and salesperson names as row labels.

2014 2015 2016 2017


Madhu 100.5 12000 20000 50000
Kailash 150.8 18000 50000 60000
Kinshuk 200.9 22000 70000 70000
Ankit 30000 30000 100000 80000
Shruti 40000 45000 125000 90000
(1) Display the sales made by all salespersons in the year 2017.
(2) Add a new column 2018 with values[50000,65000,75000,85000,95000 ]for all salesperson
(3) Delete the data for the year 2014 from the dataframe Sales

2. Create bar chart to Represent the performance of programming languages: 3


“Python","C++","Java","Perl","Scala","lisp" given by different users as 10,8,6,4,2,1
respectively using horizontal barchart.
3. Create a table and Write SQL commands for the following on the basis of given table
SALESMAN. 2+5=7

SNO SName SALARY BONUS DATE_OF_JOIN


A01 Beena Mehta 30000 45.23 2019-10-29
A02 K.L. Sahay 50000 23.34 2018-03-13
BO3 Nisha Thakur 30000 35.00 2017-03-18
BO4 Leena Yadav 80000 NULL 2018-12-31
CO5 Gautam Gola 20000 NULL 1989-01-23
C06 Trapti Garg 70000 12.37 1987-06-15
DO7 Neena Sharma 50000 27.89 1999-03-18

(I) To display Sales name and bonus after rounding off to zero decimal places.
(II) To display the position of occurrence of the “ta” in Salesman names.
(III) To display the four characters from Salesman name starting from second character.
(IV) To display the month name for the date of join of salesman.
(V) To display the name of the weekday for the date of join of salesman.
SET-3

1. PROGRAM USING PANDAS (5)

Consider a data frame with the following data stored in it:


'2019':[256,452,635,965], '2020':[745,785,478,547],
'2021':[452,474,725,854], '2022':[1021,958,528,425] index=['Qtr1','Qtr2','Qtr3','Qtr4']

Find the following:


i) Create the above dataframe using a dictionary
ii) Change sales in qtr3 during 2021 to 754 and print
iii) Add a new column 2023 with values[524,639,785,458]for all quarters
iv) Display the Sales in 2019, 2020 and 2021 for quarter 1 &2
v) Add a new row to the above dataframe with index ‘Qtr5’

2. PROGRAM USING MATPLOTLIB (3)


Write a program to draw line charts to Show the population of india vs Pakistan from 1960 –
2010. Ind=[449.48, 553.57, 696.783, 870.133,1000.4, 1309.1] Pak=[44.91, 58.06,
78.07, 107.7, 138.5, 170.6]
3. MySQL QUERIES (7)
Consider the table TEACHER and answer the questions given below:

NO NAME AGE DEPARTMENT DATEOFJOIN SALARY GENDE


R
1 JUGAL 34 COMPUTER 2000-01-10 20000.00 M
2 SHARMILA 31 HISTORY 2008-03-24 12000.00 F
3 SANDEEP 35 MATH 2006-12-12 30000.00 M
4 SANGEETHA 31 HISTORY 2007-07-01 40000.00 F
5 SHYAM 35 MATH 2007-09-05 25000.00 M
6 RAKESH 31 HISTORY 2007-02-25 30000.00 M
7 SHIVOM 44 COMPUTER 2008-06-27 21000.00 M

1. Display the name and salary of male teachers in math department.


2. Display the number of teachers in each department.
3. Display the details of all teachers who are getting salary less than 25000 of computer department.
4. Display the total salary and average salary of teachers of history department.
5. Display the name, age and department of teachers whose name contains H as the second
character.
6. Display the name, department, salary and gender of teachers in descending order of their salary.
7. Display the details of teachers joined in the year 2007.

You might also like