You are on page 1of 31

Page 1 of 31

Information
Practices
Practical file

Name: Noopur Srivastava

Class: XII-B

Session: 2023-24

INDEX
Page 2 of 31

Q1- Consider the two series objects s11 and s12 that you created in
example 11 and 12 respectively. print the attributes of both these subjects
in a report form as shown below
Q2- Object11 population stores the details of population in 4 metro cities of
India and object 12 avg. income stores the total avg. income reported in
previous year in each of these metros. Calculate income per capita for each
of these metro cities.
Q3- Create the following Series and do the specified operations:
(A) EngAlph , having 26 elements with the alphabets as values and default
index values.
(B) Vowels, having 5 elements with index labels a, e, and 'u and all the five
values set to zero. Check if it is an empty series.
(C) Friends, from a dictionary having roll numbers of fine of your friends
as data and their first name as key.
(D) MTseries, an empty Series. Check if it is an empty series.
(E) MonthDays, from a NumPy array having the number of days in the 12
months of a year. The label should be the month numbers from 1 to 12.
Q4- Using the Series created in the question 3 , write commands for the
following:
(a) Set all the values of vowels to 10 and display the Series.
(b) Divide all values of vowels by 2 and display the Series.
(c) Create another series vowels 1 having 5 elements with index labels a, e,
i, o' and 'u having values [2 6, 3, 8] respectively.
(d) Add vowels and vowels1 and assign the result to vowels3.
(e) Subtract, Multiply and Divide vowels by vowels1.
(f)Alter the labels of vowels to [ ‘A’ , E’ , ’I’ , ’O’, ’U’ ] .
Q5- Using the Series created in Question 3, write commands for the
following:
Page 3 of 31

(a)Find the dimensions, size and values of the Series EngAlph, Vowels,
Friends, MTseries, MonthDay
(b) Rename the Series MTseries as SeriesEmpty
(c)Name the index of the Series MonthDays as monthno and that of
Series Friends as Frame
(d) Display the 3rd and 2nd value of the Series Friends, in that
order.
(e)Display the alphabets 'e' to ‘p’ from the Series EngAlph.
(f) Display the first 10 values in the Series EngAlph
(g) Display the last 10 values in the Series EngAlph
(h) Display the MTseries

Q6- Create the following DataFrames Sales containing year wise


sales figures for five salesperson in INR.
Use the years as column tables , and salesperson name as row
labels.
2014 2015 2016 2017
Madhu 100.5 12000 20000 50000
Kusum 150.8 18000 50000 60000
Kinshu 200.9 22000 70000 70000
k
Ankit 30000 30000 100000 80000
Shruti 40000 45000 125000 90000

Q7 – Use the dataframe created in previous question to do the


following :
(a) Display the row labels of sales
(b) Display the colum labels of sales
(c) Display the datatypes of each column of sales
(d) Display the dimensions , shape , size and values of sales
(e) Display the last two rows of sales
(f) Display the first two columns of sales
Page 4 of 31

(g) Create a dictionary using the following data. Usethis


dictionary to create a dataframe sales2
2018
Madhu 160000
Kusum 110000
Kinshuk 500000
Ankit 340000
Shruti 900000

Q8- Use the dataframe creates in previous questions to do the


following :
(a)Append the dataframe Sales2 to the dataFrameSales.
(b)Change the DataFrame Sales such that it becomes its
transpose.
(c)Display the sales made by all the salesperson in the year
2017.
(d)Display rhe sales made by Madhu and Ankit in the years
2017 and 2018.
(e)Display the sales made by shruti in 2016.
(f)Add data to Sales for salesman Sumeet where the sales
made are [196.2,37800,52000,78348,38852} in the years
[ 2014 ,2015, 2016,2017,2018 ] respectively.
(g)Delete the data for the year 2014 from the DataFrame
Sales.
(h)Dete the data for salesman Kinshuk from the dataframe
sales
(i)change the name of the salespersom Ankit to Vivaan and
Madhu to Shailesh.
(j) update the sales made by Shailesh in 2018 to 100000.
Q9-Write a program that stores the sales of 5 fast moving items of
a store for each month in 12 Series objects,i.e., S1 Series object
stores sales of these 5 items in 1st month , S2 stores sales of these
Page 5 of 31

5 items in 2nd month, and so on The program should display the


summary sales report like this:

Q10- Three Series objects store the marks of 10 students in three


terms . Roll numbers of students from the index of these Series
objects . The Three Series objects have the same indexes .
Calculate the total weighted marks obtained by students as per
following formula
Final marks =25% Term1 + 25%. Term 2 + 50%. Term 3 Store the
final marks of students in another Seriesobject:

*************************************
PROBLEM 1

Q1- Consider the two series objects s11 and s12 that you created
in example 11 and 12 respectively. print the attributes of both
these subjects in a report form as shown below
Attribute name Object s11 Object s12
Data type
Shape
No. of bytes
No. of dimensions
Item size
Page 6 of 31

Has NaNs ?
Empty ?

SOLUTION:
Page 7 of 31

PROBLEM 2

Q2- Object11 population stores the details of population in 4


metro cities of India and object 12 avg. income stores the total avg.
income reported in previous year in each of these metros. Calculate
income per capita for each of these metro cities.
SOLUTION:
Page 8 of 31

PROBLEM 3

Q3- Create the following Series and do the specified operations:


(A) EngAlph , having 26 elements with the alphabets as values and default index
values.
(B) Vowels, having 5 elements with index labels a, e, and 'u and all the five values set
to zero. Check if it is an empty series.
(C) Friends, from a dictionary having roll numbers of fine of your friends as data and
their first name as key.
(D) MTseries, an empty Series. Check if it is an empty series.
(E) MonthDays, from a NumPy array having the number of days in the 12 months of a
year. The label should be the month numbers from 1 to 12.

SOLUTION:
(A)
Page 9 of 31

(B)

(C)
Page 10 of 31

(D)

(E)
Page 11 of 31

PROBLEM 4

Q4- Using the Series created in the question 3 , write commands


for the following:
(a) Set all the values of vowels to 10 and display the Series.
(b) Divide all values of vowels by 2 and display the Series.
Page 12 of 31

(c) Create another series vowels 1 having 5 elements with index labels a, e,
i, o and u having values [2 6, 3, 8] respectively.
(d) Add vowels and vowels1 and assign the result to vowels3.
(e) Subtract, Multiply and Divide vowels by vowels1.
(f)Alter the labels of vowels to [ ‘A’ , E’ , ’I’ , ’O’, ’U’ ] .
SOLUTION:
(A) (B)

(C)
Page 13 of 31

(D)

(E)

(F)
Page 14 of 31
Page 15 of 31

PROBLEM 5

Q5- Using the Series created in Question 3, write commands for


the following:
(A)Find the dimensions, size and values of the Series EngAlph, Vowels,
Friends, MTseries, MonthDay
(B)Rename the Series MTseries as SeriesEmpty
(C)Name the index of the Series MonthDays as monthno and that of Series
Friends as Frame
(D)Display the 3rd and 2nd value of the Series Friends, in that order.
(E)Display the alphabets 'e' to ‘p’ from the Series EngAlph.
(F)Display the first 10 values in the Series EngAlph
(G)Display the last 10 values in the Series EngAlph
(H)Display the MTseries
SOLUTION:
(A)
Page 16 of 31

(B)

(C)

(D)
Page 17 of 31

(E)

(F)

(G)
Page 18 of 31

(H)
Page 19 of 31

PROBLEM 6

Q6- Create the following DataFrames Sales containing year


wise sales figures for five salesperson in INR.
Use the years as column tables , and salesperson name as
row labels.
2014 2015 2016 2017
Madhu 100.5 12000 20000 50000
Kusum 150.8 18000 50000 60000
Kinshu 200.9 22000 70000 70000
k
Ankit 30000 30000 100000 80000
Shruti 40000 45000 125000 90000

SOLUTION:
Page 20 of 31

PROBLEM 7

Q7 – Use the dataframe created in previous question to do


the following :
(h) Display the row labels of sales
(i) Display the colum labels of sales
(j) Display the datatypes of each column of sales
(k) Display the dimensions , shape , size and values of sales
(l) Display the last two rows of sales
(m) Display the first two columns of sales
(n) Create a dictionary using the following data. Usethis
dictionary to create a dataframe sales2
2018
Madhu 160000
Kusum 110000
Kinshuk 500000
Ankit 340000
Shruti 900000

SOLUTION:
(a)

(b)

(c)
Page 21 of 31

(d)

(e)

(f)
Page 22 of 31

(g)

PROBLEM 8
Page 23 of 31

Q8- Use the dataframe creates in previous questions to do


the following :
(a)Append the dataframe Sales2 to the dataFrameSales.
(b)Change the DataFrame Sales such that it becomes its
transpose.
(c)Display the sales made by all the salesperson in the year
2017.
(d)Display rhe sales made by Madhu and Ankit in the years
2017 and 2018.
(e)Display the sales made by shruti in 2016.
(f)Add data to Sales for salesman Sumeet where the sales
made are [196.2,37800,52000,78348,38852} in the years
[ 2014 ,2015, 2016,2017,2018 ] respectively.
(g)Delete the data for the year 2014 from the DataFrame
Sales.
(h)Dete the data for salesman Kinshuk from the dataframe
sales
(i)change the name of the salespersom Ankit to Vivaan and
Madhu to Shailesh.
(j) update the sales made by Shailesh in 2018 to 100000.

SOLUTION:
(a)
Page 24 of 31

(b)

(c)

(d)
Page 25 of 31

(e)

(g)
Page 26 of 31

(h)

(i)

(j)
Page 27 of 31

PROBLEM 9
Page 28 of 31

Q9-Write a program that stores the sales of 5 fast moving


items of a store for each month in 12 Series objects,i.e., S1
Series object stores sales of these 5 items in 1st month , S2
stores sales of these 5 items in 2nd month, and so on The
program should display the summary sales report like this:

SOLUTION:
Page 29 of 31
Page 30 of 31

PROBLEM 10

Q10- Three Series objects store the marks of 10 students in


three terms . Roll numbers of students from the index of
these Series objects . The Three Series objects have the
same indexes .
Calculate the total weighted marks obtained by students as
per following formula
Final marks =25% Term1 + 25%. Term 2 + 50%. Term 3
Store the final marks of students in another Seriesobject:
SOLUTION:
Page 31 of 31

You might also like