wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Pandas DataFrame Quiz

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is a DataFrame in Pandas?

a)

A one-dimensional array

b)

A way to store data in rectangular grids

c)

A graphical representation of data

d)

A type of database

2.

Which of the following is NOT a component of a Pandas DataFrame?

a)

Data

b)

Columns

c)

Index

d)

Rows

3.

What method is used to read a CSV file into a DataFrame?

a)

pd.read_csv()

b)

pd.load_csv()

c)

pd.import_csv()

d)

pd.open_csv()

4.

Which function is used to display the first n rows of a DataFrame?

a)

df.top(n)

b)

df.start(n)

c)

df.head(n)

d)

df.first(n)

5.

How can you filter rows in a DataFrame based on a condition?

a)

Using SQL queries

b)

Using string matching

c)

Using Boolean indexing

d)

Using regular expressions

6.

What does the method df.describe() provide?

a)

Basic statistical details of numerical columns

b)

A graphical representation of data

c)

The data types of each column

d)

The shape of the DataFrame

7.

Which method is used to drop rows with missing values?

a)

df.clear_na()

b)

df.delete_na()

c)

df.remove_na()

d)

df.dropna()

8.

What is the purpose of the df.groupby() method?

a)

To filter out missing values

b)

To merge two DataFrames

c)

To sort data in ascending order

d)

To group data according to some criteria

9.

Which function is used to plot data from a DataFrame?

a)

df.graph()

b)

df.chart()

c)

df.plot()

d)

df.visualize()

10.

What does the method df.fillna() do?

a)

Displays the DataFrame shape

b)

Counts the number of missing values

c)

Removes rows with missing values

d)

Fills missing values with a specified value

11.

Which of the following is a valid way to create a DataFrame from a dictionary?

a)

pd.DataFrame(dict)

b)

pd.create_dataframe(dict)

c)

pd.new_dataframe(dict)

d)

pd.DataFrame.from_dict(dict)

12.

What does the df.shape attribute return?

a)

The index of the DataFrame

b)

The data types of each column

c)

The total number of elements

d)

The dimensionality of the DataFrame

13.

Which method is used to sort a DataFrame by a specific column?

a)

df.order_by()

b)

df.sort()

c)

df.arrange()

d)

df.sort_values()

14.

What is the purpose of the df.rank() method?

a)

To assign ranks based on position after sorting

b)

To group data by a specific column

c)

To calculate the mean of a column

d)

To filter out duplicate values

15.

What method is used to concatenate two DataFrames?

a)

pd.concat()

b)

pd.merge()

c)

pd.join()

d)

pd.append()

16.

Which function is used to convert a DataFrame to a NumPy array?

a)

df.to_numpy()

b)

df.as_array()

c)

df.to_array()

d)

df.convert_to_numpy()

17.

What does the df.info() method display?

a)

Summary of the DataFrame including data types

b)

Statistical summary of numerical columns

c)

First few rows of the DataFrame

d)

Shape of the DataFrame

18.

Which method is used to reset the index of a DataFrame?

a)

df.reset_index()

b)

df.reindex()

c)

df.set_index()

d)

df.index_reset()

19.

How can you check for duplicate rows in a DataFrame?

a)

df.duplicates()

b)

df.check_duplicates()

c)

df.duplicated()

d)

df.find_duplicates()

20.

What does the df.drop() method do?

a)

Removes specified rows or columns

b)

Displays the DataFrame without modifications

c)

Sorts the DataFrame

d)

Filters the DataFrame based on conditions