S7 IP Holidays Assignment
S7 IP Holidays Assignment
2. Complete the given Python code to get the required output as: Rajasthan
import as pd
di = {'Corbett': 'Uttarakhand', 'Sariska': 'Rajasthan', 'Kanha': 'Madhya
Pradesh’,'Gir':'Gujarat'}
NP = . Series( )
print(NP[ ])
4. Consider two objects L and S. L is a list whereas S is a Series. Both have values 20, 40,90, 110. What
will be the output of the following two statements considering that the above objects have been
created already.
print (L+2) #Statement 1
print (S+2) #Statement 2
5. Mr. Harry wants to draw a line chart using a list of elements named LIST. Complete the code to perform
the following operations:
a. To plot a line chart using the given LIST
b. To give a y-axis label to the line chart named "sample number".
import matplotlib.pyplot as PLINE
LIST=[10,20,30,40,50,60]
#Statement 1
#Statement 2
6. A dictionary ‘stationary’ contains the following: 3
stationary={‘Name’:[ ‘books’, ‘copies’, ‘pencil
box’, ‘Pen’],
‘Price’:[ 500,350, 400,250]
7. Write statements for the following:
a. Create a Dataframe named “stock”
b. Add a column called ‘discount’ with the following data: [ 15, 20, 30, 25]
c. Delete column discount with all values.
8. Differentiate between Single Row and Multi Row Functions?
9. Write a program to create the series that stores the term marks of 10 students.
Find the highest and lowest three marks scored by students.
10. Write a program to create a series from list marks and taking index values from list roll no. Show all
elements that are above 80 marks.
11. What is the difference between the following two statements, which are creating two
dataframes using the same dataframe (Pandas library has been imported as pd)?
i. Df2=pd.DataFrame(df1)
ii. Df3=pd.DataFrame(df1, copy=True)
12. Given dataFrame namely aid that stores the aid by NGOs for different states:
16. Write Python code to create the following DataFrame df1 using Python Pandas. Use anymethod of
DataFrame creation that you have learned:
Name Class Marks
Arjun XII 95
Ruchi X 84
Prerna XI 90
Himali XI 75
19. A company randomly generated a weekly winning number (between 0. 1000) for 10 weeks. An employee of the
company wants to plot the sine values of winningnumbers (nump.sin( ) function) on a line chart. Write a
program to help him accomplish this.
20. 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] ]
Page 5 of 7
Page 6 of 7
Page 7 of 7
Page 8 of 7