wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python pandas

Total questions: 35

Worksheet time: 18mins

Name
Class
Date
1.

Pandas deals with following data structures

a)

Series

b)

Series and Data Frames

c)

Series, DataFrames and Panel

d)

None of Above

2.

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

3.

DataFrame in pandas is

a)

1. dimensional array

b)

2. dimensional array

c)

3.dimensional array

d)

4.None of the above

4.

All pandas data structures are ___ mutable but not always _______mutable.

a)

a) size, value

b)

b) semantic, size

c)

c) value, size

d)

d) none of the mentioned

5.

Which of the following object you get after reading CSV file?

a)

a) DataFrame

b)

b) Character Vector

c)

c) Panel

d)

d) All of the mentioned

6.

Which of the following library is similar to Pandas?

a)

a) NumPy

b)

b) RPy

c)

c) SciPy

d)

d) None of the mentioned

7.

Full form of CSV file is

a)

Comma Separated Vault

b)

Comma Separated Value

c)

Common Separated Value

d)

Common System Value

8.

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

9.

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

10.

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

(a)  

11.

Among the following functions, which one can be used to combine dataframes when they have similar structure.

a)

combine_first

b)

concat()

c)

merge()

12.

For the concat(), if the axis=1, it will join the dataframes ...............

a)

vertically

b)

horizontally

13.

Which function can be used to combine dataframes based on common fields?

a)

merge()

b)

combine_first()

c)

concat()

14.

Which function views dataframe in the form of vertical subset ie column wise?

a)

iterrows()

b)

iteritems()

15.

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

a)

3 values from front

b)

3 values from last

c)

5 values

d)

none

16.

Series.head() will return how many rows.

a)

2

b)

3

c)

4

d)

5

17.

To extract subset from Series,the following function is used

a)

row()

b)

column()

c)

loc()

d)

all

18.

Series can be created from

a)

Array

b)

Dictionary

c)

Scatter value

d)

All of them

19.

Full form of NaN is

a)

Not a Null

b)

Not a Number

c)

Not a Numeric

d)

None of these

20.

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

21.

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

22.

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

23.

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

24.

Who is the main author of pandas?

a)

Karl pearson

b)

Wes McKinney

c)

J D Hunter

d)

None of these

25.

Given are two objects, a list object namely lst1 and a series object ser1, both are having similar values, i.e. 2,4,6,8. Find out the output produced by following statements:

(I) print (lst1*2)

(II) print (ser1*2)

(a)  

26.

which library we import if we want to draw chart

a)

numpy

b)

matplotlib

c)

pandas

27.

to add a title in the chart we use the function

a)

title("title of the chart")

b)

plt.title("title of the chart")

c)

plt.title(title of the chart)

28.

we use this function to get the average of array

a)

avg()

b)

average()

c)

mean()

29.

to get an element in data frame we use the function

a)

get()

b)

find()

c)

loc()

30.

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

31.

(a)   is the most popular open source python library used for doing data analysis.

32.

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

33.

To create a series object (a)   method is used.

34.

Given col_names = ['A', 'B', 'C', 'D'], set the column names of DataFrame df to col_names:

(a)  

35.
print(df.iloc[5]) will give output
a)
first five rows
b)
0-4 rows
c)
only 5th row
d)
Error in syntax