0% found this document useful (0 votes)
42 views3 pages

Pandas Series Worksheet1

This document is a worksheet for Class XII IP Pandas, containing various questions related to Python programming and the Pandas library. It includes tasks such as identifying data types, writing code to create and manipulate Series, and analyzing outputs from given code snippets. The worksheet aims to assess students' understanding of Pandas functionalities and Python syntax.

Uploaded by

sanjaydavne4901
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views3 pages

Pandas Series Worksheet1

This document is a worksheet for Class XII IP Pandas, containing various questions related to Python programming and the Pandas library. It includes tasks such as identifying data types, writing code to create and manipulate Series, and analyzing outputs from given code snippets. The worksheet aims to assess students' understanding of Pandas functionalities and Python syntax.

Uploaded by

sanjaydavne4901
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PM SHRI KENDRIYA VIDYALAYA AMBERNATH

CLASS XII IP PANDAS


WORKSHEET -1 (09/04/2025)
1. What data type is the object below ?
L = [1, 23, ‘hello’, 1].
a) list b) dictionary c) array d) tuple
2. Consider the following python code and write the output:
import pandas as pd
K=pd.Series([2,4,6,8,10])
s = pd.Series(K)
print (s)

3. Write the output of the following command?


import pandas as pd
L1= [1,2,3]
Ser1=pd.Series(L1*2)
print(Ser1)

4. Write attributes for the following:


i. To find the number of elements in a series S
ii. To display the values of a series as a ndarray

5. Create a series S with the following list L : [5,10,15,20,25]. Write a statement to assign the
series as a,b,c,d,e index explicitly
i. Create the series S.
ii. Display the values which are greater than or equal to 20.
iii. Display the values 15 and 20 using iloc .
iv. Display the values 10 and 15 using loc.
v. delete the value 15 from the series S.

6. Write a program to display which sections made a contribution more than Rs.5500/-
.Series Object s11 stores the charity contribution made by each section.
A 6700
B 5600
C 5000
D 52

7. Given the following Series P1 stores the marks made by each section:
P1
a 95
b 90
c 75
d 80
Write the command to display the sections made a mark greater than 90

Page 1 of 3
8. Consider a given Series , SR:
a 50
b 40
c 55
d 45
1. Write command in Python Pandas to update the index to E,F,G,H
2. Write command to delete the first element.
9. Write output for the given python code:
import pandas as pd
L1=[10,20,30,40,50]
S1=pd.Series([10,20,30,40,50])
S2=pd.Series(25,index=[0,1,2,3,4])
S3=S1*S2
print("L1*2=",L1*2)
print("S1*2=",S1*2)
print("S1*S2=",S3)

10. Given are two objects, a list object namely lst1 and a Series object namely A, both are
having similar values i.e. 2, 4, 6, 8,10. Mr. Singh is trying to run the following commands. Will
these commands run successfully or not. Justify your answer.
a. print(lst1**2)
b. print(A**2)
11. Answer the following based on the series given below.
import pandas as pd
list1=[1,2,3,4,5,6,7,8]
list2=['swimming','tt','skating','kho kho', 'bb', 'chess', 'football',"cricket"]
school=pd.Series(list1,index=list2)
school.name=("little")
print (school*2) #statement 1
print (school.tail(3)) # statement 2
print (school["tt"]) # statement 3
print (school[2:4]) # statement 4

12. Write the output of the given command:


import pandas as pd
marks= [356,401,488,392,410]
name= ["Shristi",'Aarti','Pardeep','Sunil','Rahul']
stud = pd.Series(marks,index=name)
print(stud[stud>400].sort_values())

13. Write the output of the given program:


import pandas as pd
S1=pd.Series([3,6,9,12],index=['a','b','c','e'])
S2=pd.Series([2,4,6,8],index=['c','d','b','f'])
print(S1*S2)

14. Write the output of the given command:


Page 2 of 3
import pandas as pd
s1=pd.Series([13,36,19,42],index=['a','b','c','4'])
print(s1[s1>=30])

15. Write the output of the given command:


import pandas as pd
Ser1=pd.Series([12,33,46,63])
Ser2=Ser1.sort values()
print(Ser2.head())
16. Write a program to create series from a list of numbers, numpy array with arange() to
genetate numbers 0 to 5 and a dict with 4 subject names and marks
17. Write a Program in Pandas to create series using User-defined Dictionary that contains stock
details like itemname and qty of different items
18. Given a series that stores the marks of 10 students in a class. Write code to find out the
biggest and the smallest 3 marks from the given series.
19 Create a Series that stores the salary of 10 employees. Write a program to display the salary
of those employees who are getting more than 5000.
20 . What will be the output of following code-?
import pandas as pd
s1=pd.Series([1,2,2,7,’Sachin’,77.5])
print(s1.head())
print(s1.head(3))

21. What are the purposes of following statements


1. df.columns
2. df.iloc[ : , :-5]
3. df[2:8]
4. df[ :]
5. df.iloc[ : -4 , : ]

Page 3 of 3

You might also like