wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

SERIES IN PANDAS

Total questions: 15

Worksheet time: 30mins

Name
Class
Date
1.

Series.tail(3) will return how many values.

a)

3 values from front

b)

3 values from last

c)

5 values

d)

none

2.

Which package should be needed for series

a)

Maths

b)

Statistic

c)

Pandas

d)

Random

3.

Full form of NaN is

a)

Not a Null

b)

Not a Number

c)

Not a Numeric

d)

None of these

4.

Write the output for the following:

import pandas as pd1

s = pd1.Series(5, index=[0, 1, 2, 3])

print(s)

a)

0 5

b)

0 5

1 5

2 5

3 5

dtype: int64

c)

1 5

2 5

2 5

4 5

dtype: int64

d)

0 5

1 5

2 5

3 5

dtype: object

5.

write the output:

import pandas as pd1

s = pd1.Series([1,2,3])

t = pd1.Series([1,2,4])

u=s-t

print (u)

a)

0 1

1 0

2 1

dtype: int64

b)

0 0

1 0

2 1

dtype: int64

c)

0 0

1 0

2 -1

dtype: float64

d)

0 0

1 0

2 -1

dtype: int64

6.

Let us suppose ser is a series. What will be the print statement to display last 3 elements?

a)

print(ser.head(3))

b)

print(ser.tail(3))

c)

print(ser.head())

d)

print(ser.tail())

7.

Minimum number of argument we require to pass in pandas series ?

a)

0

b)

1

c)

2

d)

3

8.

Series.head() will return how many rows.

a)

2

b)

3

c)

4

d)

5

9.

Which of the following statements are valid to create a empty series ?

a)

s1=pd.Series(0)

b)

s1=pd.Series()

c)

s1=pd.Series(NaN)

d)

s1=pd.Series(' ')

10.

To check if the Series object contains NAN values, _____________ attribute is displayed.

a)

hasnans

b)

nbytes

c)

ndim

d)

dtype

11.

To get the number of bytes of the Series Data, ___________________ attribute is used.

a)

index

b)

size

c)

itemsize

d)

ndim

12.

What will be the index of the following series?

import pandas as pd

import numpy as np

info = {'x' : 0., 'y' : 1., 'z' : 2.}

a = pd.Series(info)

print (a)

a)

0 1 2

b)

1 2 3

c)

x y z

d)

None of the above

13.

Sruti wants to create a Series with data 10, 20 , 30. She is confused from the choice given below:

a)

s= pd.Series ( [ 10, 20, 30 ] )

b)

s= pd.Series ( [ 10, 20, 30 ] , [ 0, 1, 2 ] )

c)

s= pd.Series ( index= [ 0, 1, 2 ] , data = [ 10, 20, 30 ] )

d)

All of the above

14.

If S is a series object , which command should be used to change the name of the Series object?

a)

S.index.name

b)

S.name

c)

S.index

d)

S.columns

15.

1. Given the following Series A1 and A2: 1

A1 A2

a 20 a 70

b 10 b 30

c 24 c 84

d 70 d 80

Write the command to find the sum of series A1 and A2

a)

A1+A2

b)

sum(A1,A2)

c)

a1+a2