DELHI PUBLIC SCHOOL HARNI
Informatics Practices
Class XII
Practical Assignment
Assignment Questions
1. Create a panda’s series from a dictionary of values and a ndarray.
2. Create a Series from scalar value, an index must be provided. The scalar
value will be repeated as per the length of index.
3. Write a Python code to create a Series object Temp1 that stores temperatures
of seven days in it. Take any random seven temperatures
4. Write a program to create a Series object that stores the table of number
entered by user at runtime.
5. Write a program to generate a series of float numbers from 41.0 to 60.0 with
an increment of 2.5 each.
6. Create a data frame for examination results and display row labels, column
labels data types of each column and the dimensions.
7. Create a dataframe and iterate them over rows.
8. Create a dataframe and print it along with their index using iteritems().
9. Create the following DataFrame Sales containing year wise sales figures for
five salespersons in INR. Use the years as column labels, and salesperson
names as row labels.
2018 2019 2020 2021
Kapil 110 205 177 189
Kamini 130 165 175 190
Shikhar 115 206 157 179
Mohini 118 198 183 169
a) Create the DataFrame.
b) Display the row labels of Sales.
c) Display the column labels of Sales.
d) Display the data types of each column of Sales.
e) Display the dimensions, shape, size and values of Sales.
10. Write a python program to sort the following data according to ascending
order of Age.
Name Age Designation
Sanjeev 37 Manager
Keshav 42 Clerk
Rahul 38 Accountant
11. Consider the following record in dataframe IPL
Player Team Category BidPrice Runs
Hardik Pandya Mumbai Indians Batsman 13 1000
KL Rahul Kings Eleven Batsman 12 2400
Andre Russel Kolkata Knight riders Batsman 7 900
Jasprit Bumrah Mumbai Indians Bowler 10 200
Virat Kohli RCB Batsman 17 3600
Rohit Sharma Mumbai Indians Batsman 15 3700
Write a python code to retrieve first 2 and last 3 rows using python program.
Write python code to delete the 3rd and 5th rows from dataframe df.
12. Write a program in python to calculate the sum of marks in CS subject in
a given dataset-
‘IP’:[45,55,78,95,99,97], ‘CS’:[87,89,98,94,78,77]
13. Write a Python program to Drop DataFrame Column(s) by Name or Index
14. Importing and exporting data between pandas and CSV file.
a) To create and open a data frame using ‘Student_result.csv’ file using
Pandas.
b) To display row labels, column labels data types of each column and the
dimensions
c) To display the shape (number of rows and columns) of the CSV file.
15. Read the ‘Student_result.csv’ to create data frame and do the following
operation:
a) To display Adm_No, Gender and Percentage from ‘Student_result.csv’
file.
b) To display first 5 and last 5 records from ‘student_result.csv’ file.
16. The following are the runs scored by a team in the first 5 overs:
Match 1 2 3 4 5 6 7 8 9 10
Runs Scored 6 0 2 5 10 20 15 6 18 12
Draw the line graph for the above data using matplotlib.
17. The following tables give the information about a patient’s body temperature
recorded in the hospital every hour.
Time 9 am 10 am 11 am 12 noon 1 pm
Temperature 34° C 37° C 39° C 38°C 36.5°
Draw the line graph for the above data using matplotlib.
18. Draw the double bar graph for data given below using matplotlib
[1,3,6,7,9],[5,2,7,8,2] & [2,4,6,8,10],[8,6,2,5,6]
19. Draw the histogram for population_ages = [22, 55, 62, 45, 21,
22,34,42,42,4,99,102,110,120,121,122,130,111,115,112,80,75,65,54
,44,43,42,48] and bins = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110,120,130]
through python program with suitable title and label.
20. Write a Python programming to display a Horizontal bar chart of the popularity
of programming Languages. Sample data: Programming languages: Python,
Java, PHP, JavaScript Popularity: 8.6, 8, 7.8, 6.4
21. Read the ‘Student_result.csv’ to create data frame and do the following
operation:
To display Adm_No, Gender and Percentage from ‘Student_result.csv’
file.
To display first 5 and last 5 records from ‘student_result.csv’ file.
22. Read the ‘Student_result.csv’ to create data frame and do the following
operation:
To display Student_result file with new column names.
To modify the Percentage of student below 40 with NaN value in
dataframe.
23. Write a program to plot a bar chart in python to display the result of a school
for five consecutive years.
24. For the Data frames created above, analyze, and plot appropriate charts with
title and legend.
Number of Students against Scores in all the 7 subjects
Show the Highest score of each subject
25. Take data of your interest from an open source (e.g. data.gov.in), aggregate and
summarize it. Then plot it using different plotting functions of the Matplotlib
library.
*****