wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DataFrame in Pandas

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.
A Dataframe contains Heterogeneous data
a)
true
b)
false
2.
A Dataframe Data is Immutable
a)
true
b)
false
3.
A Dataframe Size is Mutable
a)
true
b)
false
4.
A Dataframe has axes column index (axis=0) row index (axes=1)
a)
true
b)
false
5.
A data frame can be created using:
a)
Lists
b)
Dictionary
c)
Series
d)
A numpy 2D array
6.

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

a)

true

b)

false

7.

Full form of NaN is

a)

Not a Null

b)

Not a Number

c)

Not a Numeric

d)

None of these

8.

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)

9.

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

(a)  

10.

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

a)

pop()

b)

at()

c)

iloc()

11.

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])

12.

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”)

13.

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

14.
Is boolean Indexing possible in Data Frame
a)
true
b)
false
15.

The axis=1 identifies a DataFrame's ____________

a)

Rows

b)

Values

c)

Columns

d)

Data Types

16.

___________ attribute is used to specify column labels

a)

column ()

b)

column

c)

columns()

d)

columns

17.

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

a)

size

b)

shape

c)

values

d)

ndim

18.

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

a)

row()

b)

column()

c)

loc()

d)

All of the above

19.

The insert function requires ____ number of arguments in DataFrame.

a)

1

b)

2

c)

3

d)

4

20.

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