Information
Information
Information
Informatics
Practices
Practical file
INDEX
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’ ] .
Page 3 of 30
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
*************************************
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
Page 6 of 30
No. of dimensions
Item size
Has NaNs ?
Empty ?
SOLUTION:
Page 7 of 30
PROBLEM 2
PROBLEM 3
SOLUTION:
(A)
(B)
Page 10 of 30
(C)
(D)
(E)
Page 11 of 30
PROBLEM 4
(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)
(D)
Page 13 of 30
(E)
(F)
Page 14 of 30
PROBLEM 5
(B)
(C)
Page 16 of 30
(D)
(E)
Page 17 of 30
(F)
(G)
(H)
Page 18 of 30
PROBLEM 6
SOLUTION:
Page 19 of 30
PROBLEM 7
SOLUTION:
(a)
(b)
(c)
(d)
Page 21 of 30
(e)
(f)
(g)
Page 22 of 30
PROBLEM 8
SOLUTION:
(a)
(b)
Page 24 of 30
(c)
(d)
(e)
Page 25 of 30
(g)
(h)
Page 26 of 30
(i)
(j)
Page 27 of 30
PROBLEM 9
SOLUTION:
Page 28 of 30
Page 29 of 30
PROBLEM 10