Pracfile Program Index XII-C IP 2023-24
Pracfile Program Index XII-C IP 2023-24
Practices
Practical File
Page 1
Index
S.
Program Title Signature
No.
Create a Pandas Series, 'S' using data in the form a list given below:
1.
d = [11,23,31,61,87,93,78,100,120,77] Also, make the index of its elements starting
from 'A' and ending at 'J'.
Using above series write the commands for the following with outputs:
a) Display top 5 records of the series.
b) Display last 5 records of the series.
c) Retrieve third element and print it.
d) Retrieve and first three elements using default index and label index.
Create a Panda Series 'S' using randint() function to store the marks(between 1 to
2.
100) of 10 student . Use Rollno(1,2,3,4,5,6,7,8,9,10) as index of the Series.
Using above series write the commands for the following with outputs:
a) Display top 3 records.
b) Display maximum marks for above series.
c) Display marks more than 75 for above series.
d) Display average marks for the series.
e) Display 2nd, 4th , 7th, 8th elements of Series
f) Display 3rd to 7th index elements of Series using slicing
Create a Panda Series 'Sales' to store sales data (23000, 34000, 56000, 12000, 78000,
3.
10000) of six months (January-June) with months name as index of the series.
Using above series write the commands for the following with outputs:
a) Display last 3 records.
b) Display sales of February to May months using loc[] method.
c) Display sales of last three months using slicing.
d) Display total sales of all months.
e) Display first three months sales using iloc[] method
f) Display sales of those months where sales between 12000 and 33000
Create a Panda Series 'S' using a dictionary with name as key and marks as values of
4.
the dictionary. At least 8 key-value pair required.
Using above series write the commands for the following with outputs:
a) Display last 2records.
b) Display names with marks of those students whose marks below 33.
c) Display mean marks.
d) Sort the series marks in descending order and display them.
e) Display all the marks which are above 75.
f) Increase the marks of all students by 5 and display them.
Write a program to create a series object using dictionary that stores the no. of
5.
students in each section of class 12.
Sequences : section and contribution store the section names A,B,C,D,E and
6.
contribution made is respectively (6700,5600,5000,5200,nil) for a charity. Your school
Page 2
has decided to donate as much contribution as made by each section i.e. the donation
will be doubled.
Write code to create a series that stores the contribution amount as the values and
the section names as the indexes with datatype as float32. Program should display
total donation amount.
Write a program to create a Series object using an Nd-array or numpy array that has
7.
10 elements in the range 100 to 200.
No. of students in classes 11 and 12 in three streams science, commerce and
8.
humanities are stored in two series objects c11 and c12. write code to find total
number of students in classes 11 and 12, streamwise.
Consider the series object S that stores the contribution of each section, as shown
9.
below:
Section-A 4300
Section-B 6500
Section-C 3900
Section-D 6100
Write code to modify the amount of section ‘A’ as 3400 and for section ‘C’ and ‘D’ as
5000. Print the changed object.
Create the following dataframe with row index as [1001,1002,1003,1004]:
10.
Itemname Cost Qty
Laptop 56000 5
Mobile 12000 10
Desktop 34000 15
Tablets 20000 10
Add a new column 'Total Cost' = 'Cost' * 'Qty', Also display Number of
dimensions, number of elements, number of rows and columns, top 3 rows,
and bottom 3 rows of this dataframe.
Create a data frame from list containing a 2D list(nested list) for examination result
11.
which include records of students like name, marks, and percentage with suitable row
and column labels. Display row labels, column labels, data types of each column,
number of bytes and the dimensions of this dataframe.
Write a program to create a Data Frame Quarterly Sales where each row contains the
12.
Quarterly Sales of TV, Freeze and AC and perform following operations:
(i) Show the DataFrame's data.
(ii) Display AC and Freeze columns data.
(iii) Number of products sold in third quarter.
(iv) Delete details of TV column and display the dataframe.
Write a program to create a DataFrame to store Roll Number, Name and Marks of five
13.
students. Print the DataFrame and its transpose.
In an online contest, two 2-player teams’ point in 4 rounds are stored in two
14.
DataFrames as shown below:
Team 1’s points (df1) Team 2’s points (df2)
P1 P2 P1 P2
1 700 490 1 1100 1400
2 975 460 2 1275 1260
3 970 570 3 1270 1500
Page 3
4 900 590 4 1400 1190
Write a program to calculate total points earned by both the teams in each round.
Write a program to create a DataFrame with two columns name and age. Add a new
15.
column 'Updated Age' that contains age increased by 10 years. Also display the data
frame.
Given a DataFrame ( df ) as under:
16.
City Schools
Delhi 7654
Mumbai 8700
Kolkata 9800
Chennai 8600
Write a program to print DataFrame data row wise and column wise. Also display first
two rows of City column and last two rows of Schools column.
Given a dataframe 'aid' that store the aid by NGOs for different states:
17.
Write a program to create above dataframe, display dataframe, display first 3 rows
data with columns 'Toys' and 'Books' using loc[], and display last 2 rows with 'State',
'Toys' and 'Books' columns using iloc[].
Given a dataframe 'aid' that stores the aid by NGOs for different states:
18.
Write a python program to create this dataframe and display the aid for states
‘Andhra’ and ‘Odisha’ for 'books' and 'uniform' only.
Consider the following 'players.csv' file:
19.
Page 4
Write a python program to import 'players.csv' file in a dataframe, display the
dataframe data, and update 'match_played' by Rohit to 65(This change in data
should be reflected in players.csv file). Also draw a line chart for 'age' and
'match_played' using this dataframe
Plot a line graph between population(in millions) and years of India and Pakistan with
21.
following data Population of Pakistan = [44.91, 58.09, 78.07, 107.7, 138.5, 170.6,
180.3]
Population of India = [449.48, 553.57, 696.783, 870.133, 1000.4, 1309.1, 1359.5]
Years = [1960, 1970, 1980, 1990, 2000, 2010, 2019]
a) Title of the chart is 'India and Pakistan Population'
b) X-axis label is 'Years'
c) Y-axis label is 'Population in millions'
d) Show legends for lines as 'India' and 'Pakistan' separately.
e) Color of India line is red and color of Pakistan line is green
Plot a line graph between Years and Unemployment Rate in India. Use following
22.
datasets
Year=[1920,1930,1940,1950,1960,1970,1980,1990,2000,2010,2020]
Unemployment_Rate=[9.8,12,8,7.2,6.9,7,6.5,6.2,5.5,6.3,5]
a) Title of chart is 'Unemployment rate Vs Year' with fontsize=16
b) X-axis label is 'Years' with fontsize=14
c) Y-axis label is 'Unemployment Rate' with fontsize=14
d) Color of the line is 'red'
e) Use suitable marker='o' for circle and markersize=10
Plot a Bar graph between days and temperatures of seven days. Use following
23.
datasets
Days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
Temp=[32,40,36,37,30,39,41]
a) Title of chart is 'Temperature Analysis of Week'
b) X-axis label is 'Days'
c) Y-axis label is 'Temperature'
d) Use different color of each bar.
e) Use different width of each bar.
Plot a Multi Bar graph between India and Australia match. Use following set of data:
24.
Oversrange= ['1-10','10-20','20-30','30-40','40-50']
India_score=[78,56,45,78,90]
Aus_score=[34,56,78,90,56]
a) Title of graph is 'India vs Australia' with fontsize=14
b) X-axis label is 'Overs' with fontsize=14
Page 5
c) Y-axis label is 'Runs Scored' with fontsize=14
d) X-axis ticks are '1-10','10-20','20-30','30-40','40-50'. Use xticks() function
e) Use red green color bar for India and red color bar for Australia.
f) Use default width as 0.5 for both the country bars.
Pot a Histogram of a class test of 40 students based on random sets of marks
25.
obtained by the students(Maximum marks=100)
a) Title of graph is 'Marks of 40 Students' with fontsize=14
b) X-axis label is 'Marks Interval' with fontsize=14
c) Y-axis label is 'Number of Students' with fontsize=14
d) Use bins for histogram as [0,10,20,30,40,50,60,70,80,90,100]
e) X-axis ticks are [0,10,20,30,40,50,60,70,80,90,100]. Use xticks() function
f) Use green color for bars
Pot a Histogram of heights(in cm) of 10 students based on random sets of heights of
26.
students(Maximum height=190cm)
a) Title of graph is 'Heights of Students' with fontsize=14
b) X-axis label is 'Height Interval' with fontsize=14
c) Y-axis label is 'Number of Students' with fontsize=14
d) Use bins for histogram as [100,120,140,160,180,200]
e) X-axis ticks are [100,120,140,160,180,200]. Use xticks() function
f) Use red color for bars
27. SQL Statements
Page 6