Assignment 2021-22
Assignment 2021-22
(Assignment 2021-22)
Name Age
0 Alex 10
1 Bob 12
2 Clark 13
Ans:
Q2. Mr. Sanjay wants to plot a bar graph for the given set of values of subject on x-axis
and number of students who opted for that subject on y-axis. Complete the code to
perform the following:
'SST'] y=[10,20,30,40]
Ans:
Q3. Mr. Harry wants to draw a line chart using a list of elements
named LIST. Complete the code to perform the following
operations:
import matplotlib.pyplot as
PLINE
LIST=[10,20,30,40,50,60]
(i) To plot a line chart using the given LIST,
(ii) To give a y-axis label to the line chart named “Sample Numbers”
Ans:
Q4. Given the following set of data :
Ans:
Q6. Reading and Writing CSV Files in Python
Ans:
Q7 .Write a python code to create a dataframe with appropriate headings from the list
given below :
Ans:
Q8. Write a small python code to create a dataframe with headings(a and b) from the list
given below
: [[1,2],[3,4],[5,6],[7,8]]
Q9. Consider the following dataframe, and answer the questions
given below: import pandas as pd
df = pd.DataFrame( { “Quarter1":[2000, 4000, 5000, 4400, 10000],
"Quarter2":[5800, 2500, 5400, 3000, 2900],
"Quarter3":[20000, 16000, 7000, 3600, 8200],
"Quarter4":[1400, 3700, 1700, 2000, 6000] })
(i) Write the code to find mean value from above data frame df over the index and
column axis.
(ii) Write the code to find sum() function to find the sum of all the values over the
index axis.
(iii) Write the code to find the median of the data frame df.
Ans:
Q10. Consider a given Series , M1:
Ans:
Q11. Consider the following Series object, S_amt
Ans:
Q12. Consider the following DataFrame, classframe.
Ans:
Q13. Consider the following graph . Write the code to plot it
Ans:
Q.14 Draw the following bar graph representing the number of students in each class.
Ans:
Q15. Write a program in Python Pandas to create the following DataFrame
batsman from a Dictionary:
Ans: