Saturday, April 29, 2023

Series in Pandas Test - 29 April 2023

 Class 12 - B Series in Pandas Test:, GBSSS Khajoori Khas

1. Create a Series and Explain the use of head() and tail()

import pandas as pd

D=[10,20,30,40,50,60,70,80,90]

I=['a','b','c','d','e','f','g','h','i']

S=pd.Series(D,I)

print(S)

print(S.head())  #print —-------------------- elements

print(S.tail())     #print —-------------   elements

print(S.head(3))    #print —-----------------  elements

print(S.tail(3))    #print —----------- elements

print(S.head(-2))   #print —--- —---------------- elements (not print —------------  elements)

print(S.tail(-2))   #print —---------------- elements (not print —---------------- elements)

2. Which of the following are modules/libraries in Python?

a. NumPy

b. Pandas

c. Matplotlib

d. All of the above

3. NumPy stands for ____

a. Number Python

b. Numerical Python

c. Numbers in Python

d. None of the above

  1. _________ is an important library used for analyzing data.

a. Math

b. Random

c. Pandas

d. None of the above

  1. Important data structure of pandas is/are ___________

a. Series

b. Data Frame

c. Both of the above

d. None of the above

  1. Pandas Series can have _________________ data types

a. float

b. integer

c. String

d. All of the above

  1. _________ is used when data is in Tabular Format.

a. NumPy

b. Pandas

c. Matplotlib

d. All of the above

  1. Which of the following commands is used to install pandas?

a. pip install pandas

b. install pandas

c. pip pandas

d. None of the above


No comments:

Post a Comment