wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

pandas

Total questions: 118

Worksheet time: 1hrs 10mins

Name
Class
Date
1.

Which is not a feature of series

a)

Homogeneous data

b)

Immutable size

c)

Mutable data

d)

Multiple rows

2.

Dataframe have

a)

2D Array

b)

Mutable size

c)

Mutable data

d)

All of above

3.

Which package should be needed for series

a)

Maths

b)

Statistic

c)

Pandas

d)

Random

4.

Full form of NaN is

a)

Not a Null

b)

Not a Number

c)

Not a Numeric

d)

None of these

5.

Dataframe can be created using

a)

Array

b)

Dictionary

c)

List

d)

All of these

6.

Full form of CSV file is

a)

Comma Separated Vault

b)

Comma Separated Value

c)

Common Separated Value

d)

Common System Value

7.

Not a function of Dataframe

a)

Head()

b)

Tail()

c)

loc()

d)

multi()

8.

which functions used to transfer data from dataframe to CSV files

a)

to_data()

b)

to_csv()

c)

df_csv()

d)

from_dataframe()

9.

Dataframe can contain multiple series

a)

True

b)

False

10.

Which is true for series.

a)

Size is mutable,Values is mutable

b)

size is immutable,values is mutable

c)

size is mutable,values is immutable.

d)

none

11.

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

a)

3 values from front

b)

3 values from last

c)

5 values

d)

none

12.

Series.head() will return how many rows.

a)

2

b)

3

c)

4

d)

5

13.

To extract subset from Series,the following function is used

a)

row()

b)

column()

c)

loc()

d)

all

14.

we can analyze the data in pandas with :

a)

Series

b)

Dataframe

c)

Both

d)

none

15.

Series in Pandas is

a)

1 Dimensional Array

b)

2 Dimensional array

c)

3 Dimensional array

d)

none of above

16.

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

a)

0

b)

1

c)

2

d)

3

17.

In data science, which of the python library are more popular ?

a)

numpy

b)

pandas

c)

django

d)

none

18.

Which is not a feature of series

a)

Homogeneous data

b)

Immutable size

c)

Mutable data

d)

Multiple rows

19.

Series can be created from

a)

Array

b)

Dictionary

c)

Scatter value

d)

All of them

20.

Which package should be needed for series

a)

Maths

b)

Statistic

c)

Pandas

d)

Random

21.

Full form of NaN is

a)

Not a Null

b)

Not a Number

c)

Not a Numeric

d)

None of these

22.

Data structures in Pandas can be mutated in the terms of ____ but not of _____.

a)

size, value

b)

value, size

c)

semantic, size

d)

none of the above

23.

pandas is a:

a)

Data Structure

b)

Series

c)

Dataframe

d)

Library

24.

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

25.

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

26.

write the output:

import pandas as pd

s=pd.Series([1,2,3,4],index=['a','b','c','d'])

print(s.iloc[2:4])

a)

b 2

c 3

d 4

dtype: int64

b)

b 3

c 4

dtype: int64

c)

c 3

d 4

dtype: int64

d)

none of the above

27.

write the output:

import pandas as pd

s=pd.Series([1,2,3,4],index=['a','b','c','d'])

print(s.loc['b':'d'])

a)

b 2

c 3

d 4

dtype: float64

b)

b 2

c 3

d 4

dtype: object

c)

c 3

d 4

dtype: int64

d)

b 2

c 3

d 4

dtype: int64

28.

Series is

a)

A one dimensional structure

b)

A two dimensional structure

c)

A three dimensional structure

d)

None of the Above

29.

Data Frames is

a)

One Dimensional

b)

Two Dimensional

c)

Three Dimensional

d)

None of the above

30.

Series is

a)

Mutable

b)

Immutable

31.

Which is correct line to import pandas

a)

import Pandas as pd

b)

import panda as pd

c)

import pandas as pd

32.

s = pd.series([1,2,3,4,5],index=['a','b','c','d','e'])

print(s[:3] gives ?

a)

a 1

b 2

c 3

b)

a 1

b 2

c 3

d 4

c)

a 3

b 4

c 5

33.

series = pd.series(55)

print(series) gives ?

a)

0 51

1 52

2 53

3 54

4 55

b)

1 51

2 52

3 53

4 54

5 55

c)

0 55

1 55

2 55

3 55

4 55

34.

s = pd.series(range(1,15,3),index = [x for x in 'abcde'])

print(s) gives ?

a)

a 1

b 4

c 7

d 10

e 13

b)

a 0

b 3

c 6

d 9

e 12

c)

x 1

x 4

x 7

x 10

x 13

35.

series = pd.series({'jan':31,"feb':29,'march':31})

print(series) gives ?

a)

jan 31

feb 29

march 31

b)

0 31

1 29

2 31

c)

0 jan

1 feb

2 march

36.

Data Frame contains ?

a)

Data of same Types

b)

Data of Different Types

37.

s1 = pd.series([11,12,13,14])

s2 = pd.series([11,12,13,14],index=[1,2,3,4])

print(s1+s2) gives ?

a)

0 22

1 24

2 26

3 28

b)

0 11

1 12

2 13

3 14

0 11

1 12

2 13

3 14

c)

Error

38.

Best way to import the pandas module in your program ?

a)

1.import pandas

b)

2.import pandas as pd

c)

3.from pandas import *

d)

4.All of the above

39.

Which is true for series.

a)

Size is mutable,Values is mutable

b)

size is immutable,values is mutable

c)

size is mutable,values is immutable.

d)

none

40.

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

a)

3 values from front

b)

3 values from last

c)

5 values

d)

none

41.

Series.head() will return how many rows.

a)

2

b)

3

c)

4

d)

5

42.

To extract subset from Series,the following function is used

a)

row()

b)

column()

c)

loc()

d)

all

43.

we can analyze the data in pandas with :

a)

Series

b)

Dataframe

c)

Both

d)

none

44.

Series in Pandas is

a)

1 Dimensional Array

b)

2 Dimensional array

c)

3 Dimensional array

d)

none of above

45.

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

a)

0

b)

1

c)

2

d)

3

46.

Series can be created from

a)

Array

b)

Dictionary

c)

Scatter value

d)

All of them

47.

Full form of NaN is

a)

Not a Null

b)

Not a Number

c)

Not a Numeric

d)

None of these

48.

pandas is a:

a)

Data Structure

b)

Series

c)

Dataframe

d)

Library

49.

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

50.

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

51.

write the output:

import pandas as pd

s=pd.Series([1,2,3,4],index=['a','b','c','d'])

print(s.iloc[2:4])

a)

b 2

c 3

d 4

dtype: int64

b)

b 3

c 4

dtype: int64

c)

c 3

d 4

dtype: int64

d)

none of the above

52.

DataFrame is .......................

a)

size mutable, data mutable

b)

size immutable, data mutable

53.

An empty DataFrame can be created by.................

a)

passing arguments

b)

without passing arguments

54.

Which of the functions can be used to delete column/row from a DataFrame?

a)

pop()

b)

at()

c)

drop()

d)

iloc()

55.

Full form of CSV file is

a)

Comma Separated Vault

b)

Comma Separated Value

c)

Common Separated Value

d)

Common System Value

56.

Dataframe can contain multiple series

a)

True

b)

False

57.

Which is the correct Pandas syntax to read in a csv file and assign it to a DataFrame df?

a)

df = read_csv('file.csv')

b)

df = read('file.csv', type = 'csv')

c)

df = pd.read_csv('file.csv')

d)

df = with open('file.csv') as pd.DataFrame

58.

Which is true for series.

a)

Size is mutable,Values is mutable

b)

size is immutable,values is mutable

c)

size is mutable,values is immutable.

d)

none

59.

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

a)

3 values from front

b)

3 values from last

c)

5 values

d)

none

60.

Series.head() will return how many rows.

a)

2

b)

3

c)

4

d)

5

61.

To extract subset from Series,the following function is used

a)

row()

b)

column()

c)

loc()

d)

all

62.

we can analyze the data in pandas with :

a)

Series

b)

Dataframe

c)

Both

d)

none

63.

Series in Pandas is

a)

1 Dimensional Array

b)

2 Dimensional array

c)

3 Dimensional array

d)

none of above

64.

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

a)

0

b)

1

c)

2

d)

3

65.

Which is not a feature of series

a)

Homogeneous data

b)

Immutable size

c)

Mutable data

d)

Multiple rows

66.

Series can be created from

a)

Array

b)

Dictionary

c)

Scatter value

d)

All of them

67.

Which package should be needed for series

a)

Maths

b)

Statistic

c)

Pandas

d)

Random

68.

Full form of NaN is

a)

Not a Null

b)

Not a Number

c)

Not a Numeric

d)

None of these

69.

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

70.

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

71.

write the output:

import pandas as pd

s=pd.Series([1,2,3,4],index=['a','b','c','d'])

print(s.iloc[2:4])

a)

b 2

c 3

d 4

dtype: int64

b)

b 3

c 4

dtype: int64

c)

c 3

d 4

dtype: int64

d)

none of the above

72.

write the output:

import pandas as pd

s=pd.Series([1,2,3,4],index=['a','b','c','d'])

print(s.loc['b':'d'])

a)

b 2

c 3

d 4

dtype: float64

b)

b 2

c 3

d 4

dtype: object

c)

c 3

d 4

dtype: int64

d)

b 2

c 3

d 4

dtype: int64

73.

Pandas is_________.

a)

a Python library that is built on NumPy and provides easy-to-use data structures and data analysis tools for the Python programming language.

b)

a Python 2D plotting library which produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms.

c)

a Python library that implements a range of machine learning,

preprocessing, cross-validation and visualization algorithms using a unified interface.

74.

Give the output of the following code:


>>>import pandas as pd

>>>dict1 = {'AR' : 100, 'VR' : 200, 'AI' : 300}

>>>ser = pd.Series(dict1)

>>>print(ser[1])

a)

AR

b)

100

c)

VR

d)

200

75.
a)

print(ser[2,4])

b)

print(ser[[2:4]])

c)

print(ser[[2,4]])

d)

print(ser[2,3,4])

76.

Which of the following commands is used to install Pandas?

a)

pip install python-pandas

b)

pip install pandas

c)

python install python

d)

python install pandas

77.

a)

print(ser[[1,3]])

b)

print(ser[1:3])

c)

print(ser[[1:3]])

d)

print(ser[1,3])

78.

Have you enjoyed the quiz on Pandas Series?

a)

Yes

b)

No

79.

Missing data in panda series and dataframe can be filled with a (a)   value.

80.

Basic feature of series are

a)

Homogeneous data  Size Immutable  Values of Data Mutable

b)

Hetrogenous data  Size Immutable  Values of Data Mutable

c)

immutable size, immutable data

81.

DataFrame is ______________

a)

photo frame with data

b)

module

c)

like a two dimensional array with heterogeneous data

82.

Which function from the options given below can read the dataset from a large text file?

a)

read_json

b)

read_pickle

c)

read_hdf

d)

read_csv

83.

Which among the following options can be used to create a DataFrame in Pandas?

a)

A scalar value

b)

An ndarray

c)

A python dict

d)

All of the above

84.

What does this line of code do?

a)

Selects cols with vals > 1

b)

Selects cols without NaN

c)

Selects cols with any vals >1

d)

Selects cols with NaN

85.

What does this line of code do?

a)

Drops NaN values

b)

Replaces values with others

c)

Fills NaN values with a predetermined value

86.

_____ is a two-dimensional labelled data structure with columns of potentially different types, while_____ is a one-dimensional labelled array capable of holding any data type

a)

Series, DataFrame

b)

DataFrame, Series

87.

____iterates over the DataFrame columns, returning a tuple with the column name and the content as a Series.


____returns a tuple with row index and row data as a Series object.

a)

df.iteritems(), df.iterrows()

b)

df.iterrows(), df.items()

88.

What does this line of code do?

a)

Returns unique values

b)

Checks duplicates

c)

Drops duplicates

d)

Checks index duplicates

89.

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

90.

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

91.

write the output:

import pandas as pd

s=pd.Series([1,2,3,4],index=['a','b','c','d'])

print(s.iloc[2:4])

a)

b 2

c 3

d 4

dtype: int64

b)

b 3

c 4

dtype: int64

c)

c 3

d 4

dtype: int64

d)

none of the above

92.

write the output:

import pandas as pd

s=pd.Series([1,2,3,4],index=['a','b','c','d'])

print(s.loc['b':'d'])

a)

b 2

c 3

d 4

dtype: float64

b)

b 2

c 3

d 4

dtype: object

c)

c 3

d 4

dtype: int64

d)

b 2

c 3

d 4

dtype: int64

93.

To extract subset from Series,the following function is used

a)

row()

b)

column()

c)

loc()

d)

all

94.
df[‘List3’]=df[‘List1’]+df[‘List2’]
a)
Syntax is correct
b)
sytax not correct
c)
Can not use arithmatic operators
95.
print(df.tail()) will give output
a)
first five rows
b)
last five rows
c)
only last 01 row
d)
Error in syntax
96.
print(df.iloc[5]) will give output
a)
first five rows
b)
0-4 rows
c)
only 5th row
d)
Error in syntax
97.

Predict the output:

obj2=pd.Series([3.5,5.,6.5,8.])

print(obj2.size,obj2.hasnans)

a)

4 False

b)

4 True

c)

4 F

d)

3 True

98.

What will be the output of following code?

stu={'A':44,'B':44,'C':45,"D":47}

s8=pd.Series(stu)

print(s8[ :2]*100)

a)

A 4400

B 4000

dtype: int64

b)

A 4300

B 4000

dtype: int64

c)

A 4300

B 3000

dtype: int64

d)

A 3300

B 4000

dtype: int64

99.
A Dataframe contains Heterogeneous data
a)
true
b)
false
100.
A Dataframe Data is Immutable
a)
true
b)
false
101.
A Dataframe Size is Mutable
a)
true
b)
false
102.
A Dataframe has axes column index (axis=0) row index (axes=1)
a)
true
b)
false
103.
A data frame can be created using:
a)
Lists
b)
Dictionary
c)
Series
d)
A numpy 2D array
104.

df['Tid'] & df.Tid are same

a)

true

b)

false

105.

Full form of NaN is

a)

Not a Null

b)

Not a Number

c)

Not a Numeric

d)

None of these

106.

Which of the following commands is used to convert array named "grades" into data frame named "df_grades"?

a)

df_grades = grades

b)

df_grades = pd.DataFrame(grades)

c)

df_grades = pd.DataFrame("grades")

d)

grades = pd.DataFrame(df_grades)

107.

Type the syntax that returns the top 5 rows in DataFrame df with the native Pandas function (not slicing):

(a)  

108.

Which of the functions can be used to delete column/row from a DataFrame?

a)

pop()

b)

at()

c)

iloc()

109.

Which of the following statement/s will give 3 rows from bottom of the dataframe ?

a)

Print(df.tail())

b)

print(df.tail(3))

c)

print(df.tail[3])

110.

i) Which of the following statement will delete rank2 row from the dataframe ?

a)

df.drop(‘rank2’)

b)

df.drop(rank2)

c)

delete df(rank2)

d)

df.del(“rank2”)

111.

The instructor wants to add a new column, Marks to the dataframe. The values of the marks will be 12, 22, 21, 24. Help him to choose the correct command to do so.

a)

a) Df.columns=[12, 22, 21, 24]

b)

b) df[‘marks’] = [12, 22, 21, 24]

c)

c) df.loc[marks] = [12, 22, 21, 24]

d)

d) Both (b) and (c) are correct

112.
Is boolean Indexing possible in Data Frame
a)
true
b)
false
113.

The axis=1 identifies a DataFrame's ____________

a)

Rows

b)

Values

c)

Columns

d)

Data Types

114.

___________ attribute is used to specify column labels

a)

column ()

b)

column

c)

columns()

d)

columns

115.

To get number of elements in a DataFrame _____ attribute may be used.

a)

size

b)

shape

c)

values

d)

ndim

116.

To extract a row / column from a DataFrame ___ function may be used

a)

row()

b)

column()

c)

loc()

d)

All of the above

117.

The insert function requires ____ number of arguments in DataFrame.

a)

1

b)

2

c)

3

d)

4

118.

For the given DataFrame df, what will be the code to get the value 38?

a)

df . iloc [1,1]

b)

df . Age [222]

c)

df . loc [111]

d)

None of the above