[This question paper contains 8 printed pages.
Your Rol
l No.
Sr. No. of Question Paper: 5025 H
Unique Paper Code : 2342201202
Name of the Paper Data
: Interpretation and
Visualization using Python
Name of the Co
urse : [Link]. (Prog.)
Semester
Π
:
Duration: 3 Hours Maximum Marks: 90
Instructions for Candidates
1. Write your Roll No. on the top immediately on receipt
of this question paper.
2. Section A is compulsory.
3. Attempt any 4 (four) questions from Section B.
4. Parts of a question must be answered together.
Section A
(Compulsory)
1. (a) Briefly explain different measures of central
tendencу. (3)
कालिन्दी महाविद्यालय पुस्तकालय P.T.O.
KALINDI COLLEGE LIBRARY
2
5025
(b) With help of an example differentiate between loe
and iloe operators. (3)
(c) Write and justify the output of the given script.
import pandas as pd
s1 = [Link]([Link](5),
index=['a', 'c', 'b', 'e', 'd'])
print(s1)
print(s1['b' : 'd']) (3)
(d) Write and justify the output of the given Python
statements. (3)
import pandas as pd
df = [Link]([Link](20).reshape(4,5))
print(df)
(e) Write the formula for calculating range. Calculate
the range for the given data [32, 12, 56, 33, 44].
(3)
(f) Write and justify the output of the given Python
statements. (3)
import pandas as pd
df = [Link]([Link](20).reshapе(4.5))
print(df)
कालिन्दी महाविद्यालय पुस्तकालय
KALINDI COLLEGE LIBRARY
3
5
502
(g) What is a pivot table? Give one example. (3)
(h) Write the use of randint() function using
appropriate example. (3)
(i) What is the purpose of legend in plotting? Explain
with appropriate example. (3)
() Briefly explain regression using example. (3)
SECTION-B
2. (a) Consider the two given dataframes studf and resdf
and write the Python statements to do the
following: (10)
studf resdf
rollno name rollno marks
101 abc 101 66
102 pqr 102 76
103 xyz 101 55
104 82
(i) Display the rollno, name and marks for the
students who appear in both datafræmes:
(ii) Display the rollno, name and marks of
students who appear in either dataframe.
P.T.O.
कालिन्दी महा
विद्यालय पुस्तकाल
KALINDI C य
OL LEGE LIB
RARY
5025 4
1
(iii) Count the number of students whose result
is not available yet.
(iv) Display the rollno of the students who do
not appear in dataframe studf.
(v) Display all the unique rollnos present in
either dataframe.
(b) With the help of suitable example, differentiate
between is null() and notnull() methods. (5)
3. (a) Consider the given dataframe my df and write the
Python statements to perform the following
operations: (10)
age weight
102 23 52
103 34 67
101 25 60
(i) Set the title of the row index as rollno.
(ii) Add a column 'height' with values 152,
165, 171.
कालिन्दी महाविद्यालय पुस्तकालय
KALINDI COLLEGE LIBRARY
5025 5
(iii) Sort the datafram
e in descending order of
the age column.
(iv) Reindex the datafram
e in the orden.101,
102 and 103.
(v) Drop the row corresponding to row index
102.
(b) What are the different ways to han
dle missing
data?
(5)
4. (a) Consider the file [Link] as given below and
answer the following questions. (10)
year;qtrl;qtr2;qtr3;qtr4
2019;3000;3200;;3500
2020;2900;-9999;;
2021;1800;2100;1900;1950
2021;1800;2100;1900;1950
2022;1850;-9999;2900;2550
2023:3400;3200;;
(i) Load the file [Link] into a dataframe.
कालिन्दी महाविद्यालय पुस् P.T.O.
तकालय
KALINDI COLLEGE
LIBRARY
5025 6
(ii) Fill all the NaN values with 0.
(iii) Remove the duplicate rows from the
original dataframe.
(iv) Replace all the -9999 values with a 0.
(v) Print the average sales made during qtrl
across all the years.
(b) Differentiate between stack() and unstack(
)
methods. Give examples. (5)
5. (a) Write the Python statements to do the following
using numpy package: (10)
(i) Create an array. a = [2,4,5,6,11,12,34,67,
75,60]
(ii) Write numpy functions to find its minimum
and maximum value.
(iii) Give output: print (a[2:9]) and print (a[2:])
(iv) Give output: print (a[:7]) and print (a[:])
(v) Differentiate between rand() and nrand()
कालिन्दी महाविद्यालय पुस्तकालय
KALINDI COLLEGE LIBRARY
5025 7
function using appropriate examplc.
(b) Write the Python statements to create a dataframe
tempdf for the given dataset and then plot a scatter
chart with X1 on x-axis and X2 on y-axis. The
points should be plotted in red colour.
(5)
X1 X2
-2 3
1
1 2
3 4
5. (a) Write the Python statements to do the following
package:
(10)
using numpy
(i) Create a 3×3 matrix with values ranging
from 12 to 20
(ii) Create a 5×5 identity matrix.
2×4 matrix filled wi
th 1s
(iii) Create a
random
(iv) Create a 3×2, matrix filled with
values
5×4 matrix
(v) Change a 4×5 matrix into
to create the give
n 3×3
th on st at em en ts
(b) Write py t its
us in g ar an ge () in numpy and prin
ma tr ix
transpose.
कालिन्दी महाविद्यालय पुस्तकालय
KALINDI COLLEGE LIBRARY
5025 8
3 5
A= 7 11
(
13 15 17
7. (a) Write python statements to perform the followin
operations using matplotlib package for the give
dataset. (10
Mon Tuc Wed Thu Fri Sat Sun
Days
40 42 35 36 41
Temperature 30 31
in Degree
Celsius
(i) Plot histogram of the given dataset.
(ii) Set title as "7 Days Temperature".
(iii) Set X-axis label as" Weekdays"
(iv) Set Y-axis label as"Temperature"
(v) Save the plotted image as "[Link]
(b) Differentiate between stacked bars and heat maf
(
Also write python commands to plot them.
कालिन्दी महाविद्यालय पुस्तकालय
KALINDI COLLEGE LIBRARY
(1500