0% found this document useful (0 votes)
4 views2 pages

Python Revision (Assignment

The document consists of a series of questions related to the Pandas library in Python, focusing on the creation and manipulation of Series objects. It includes multiple-choice questions, assertions, and programming tasks that test knowledge of Pandas syntax and functionality. The target audience appears to be students learning about data manipulation using Pandas.

Uploaded by

Aarav Bhatia
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)
4 views2 pages

Python Revision (Assignment

The document consists of a series of questions related to the Pandas library in Python, focusing on the creation and manipulation of Series objects. It includes multiple-choice questions, assertions, and programming tasks that test knowledge of Pandas syntax and functionality. The target audience appears to be students learning about data manipulation using Pandas.

Uploaded by

Aarav Bhatia
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/ 2

Indraprastha INTERNATIONAL SCHOOL

Sector 10, Dwarka, New Delhi – 110075

ASSI/IP/XII/April/2025-26
No. 2
Topic: SERIES

1. Which of the following command will show the last 3 rows from a Pandas Series named NP?
a. NP.Tail( ) b. NP.tail(3)
c. NP.TAIL(3) d. All of the above

2. To display last five rows of a series object ‘S’, you may write:
a. S.head( ) b. S.Tail(5)
c. S.head(5) d. S.tail( )

3. Assertion (A):- To use the Pandas library in a Python program, one must import it.
Reasoning (R): - The only alias name that can be used with the Pandas library is pd.
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True

4. Which of the following statement will import pandas library?


i. Import pandas as pd ii. import Pandas as py
iii. import pandas as pd iv. import panda as pd

5. While trying to create series from dictionary, keys of dictionary become index.
(a) True (b) False (c) Depends on Python Version (d) None of the above

6. To get the number of dimensions of Series object, attribute is used.


(a) size (b) shape (c) itemsize (d) ndim

7. To skip not numeric or null values in series, we can use attribute


(a) skip (b) skipna (c) skipNaN (d) None of the above

8. What will be correct syntax for pandas series?


(a) pandas_Series( data, index, dtype)
(b) panda.series( data, index, dtype)
(c) pandas.Series( data, index, dtype)
(d) panda_Series( data, index, dtype)

9. To get the size of the datatype of the items in Series object, you can use ______ attribute.
(a) index (b) size (c) itemsize (d) ndim

10. To get the number of elements in a Series object, attribute may be used.
(a) index (b) size (c) itemsize (d) ndim

11. To get the number of bytes of the Series data, attribute is displayed.
(a) hasnans (b) nbytes (c) ndim (d) dtype

12. To display third element of a Series object S, you will write .


(a) S[:3] (b) S[2] (c) S[3] (d) S[:2]
13. Predict the output of the given Python code:
import pandas as pd
list1=[-10,-20,-30]
ser = pd.Series(list1*2)
print(ser)

14. 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[ ])
NP = pd.Series( di)
print(NP[ 'Sariska'])
15. Write a program to create a series object using a dictionary that stores the number of students in
each house of class 12D of your school.
Note: Assume four house names are Beas, Chenab, Ravi and Satluj having 18, 2, 20, 18
students respectively and Pandas library has been imported as pd.

16. What will be the output of the following code:


>>> import pandas as pd
>>> A=pd.Series(data=[35,45,55,40])
>>> print(A>45)

17. Which of the following code will generate the following output?
Jan 31
Feb 28
Mar 31
dtype: int64

(a) import pandas


S1 = pd.Series(data = [31,28,31], index=["Jan","Feb","Mar"])
print(S1)
(b) import pandas as pd
S1 = p1.series([31,28,31], index=["Jan","Feb","Mar"])
print(S1)
(c) import pandas as pd
S1 = pd.Series([31,28,31], columns=["Jan","Feb","Mar"])
print(S1)
(d) import pandas as pd
S1 = pd.Series([31,28,31], index=["Jan","Feb","Mar"])
print(S1)

You might also like