Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Pandas Practical Quiz

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.

Section A: Creating, Reading & Writing Data — Which function is used to read a CSV file into a DataFrame?

a)

pd.read()

b)

pd.read_csv()

c)

pd.load_csv()

d)

pd.import_csv()

2.

Section A: Creating, Reading & Writing Data — Which parameter in read_csv() specifies the column to use as index?

a)

index

b)

index_col

c)

use_index

d)

set_index

3.

Section A: Creating, Reading & Writing Data — What does pd.DataFrame() primarily create?

a)

A Series

b)

A NumPy array

c)

A 2-D labeled data structure

d)

A dictionary

4.

Section A: Creating, Reading & Writing Data — Which method saves a DataFrame to a CSV file?

a)

df.write_csv()

b)

df.save_csv()

c)

df.to_csv()

d)

pd.to_csv()

5.

Section A: Creating, Reading & Writing Data — What is the default delimiter for read_csv()?

a)

Tab

b)

Semicolon

c)

Space

d)

Comma

6.

Section A: Creating, Reading & Writing Data — What does df.head() return by default?

a)

Last 5 rows

b)

First 10 rows

c)

First 5 rows

d)

Entire DataFrame

7.

Section A: Creating, Reading & Writing Data — Which object represents a single column of a DataFrame?

a)

DataFrame

b)

Series

c)

Array

d)

List

8.

Section A: Creating, Reading & Writing Data — Which argument limits rows read from a CSV?

a)

max_rows

b)

rows

c)

nrows

d)

limit

9.

Section A: Creating, Reading & Writing Data — What does df.shape return?

a)

Number of columns

b)

Number of rows

c)

(rows, columns)

d)

Column names

10.

Section A: Creating, Reading & Writing Data — Which function reads Excel files?

a)

pd.read_excel()

b)

pd.read_xls()

c)

pd.read_sheet()

d)

pd.open_excel()

11.

Section B: Indexing, Selecting & Assigning — Which accessor is label-based?

a)

iloc

b)

loc

c)

iat

d)

values

12.

Section B: Indexing, Selecting & Assigning — Which accessor is integer-position based?

a)

loc

b)

at

c)

iloc

d)

labels

13.

Section B: Indexing, Selecting & Assigning — What does df['col'] return?

a)

DataFrame

b)

Series

c)

List

d)

NumPy array

14.

Section B: Indexing, Selecting & Assigning — How do you select multiple columns?

a)

df['A','B']

b)

df[['A','B']]

c)

df('A','B')

d)

df[A,B]

15.

Section B: Indexing, Selecting & Assigning — Which is used for conditional row filtering?

a)

df.filter()

b)

Boolean indexing

c)

df.where() only

d)

df.select()

16.

Section B: Indexing, Selecting & Assigning — What does df.iloc[0] return?

a)

First column

b)

First row

c)

Entire DataFrame

d)

Index only

17.

Section B: Indexing, Selecting & Assigning — Which method sets a column as index?

a)

df.make_index()

b)

df.index()

c)

df.set_index()

d)

df.assign_index()

18.

Section B: Indexing, Selecting & Assigning — What does df.at[row, col] access?

a)

Multiple values

b)

A slice

c)

A single scalar value

d)

Entire column

19.

Section B: Indexing, Selecting & Assigning — Which is faster for scalar access?

a)

loc

b)

iloc

c)

at / iat

d)

values

20.

Section B: Indexing, Selecting & Assigning — What does df.rename() do?

a)

Renames rows/columns

b)

Deletes columns

c)

Sorts index

d)

Changes datatype

21.

Section C: Summary Functions & Maps — Which function gives statistical summary?

a)

df.stats()

b)

df.summary()

c)

df.describe()

d)

df.info()

22.

Section C: Summary Functions & Maps — What does df.mean() compute?

a)

Row means

b)

Column means

c)

Overall mean only

d)

Index mean

23.

Section C: Summary Functions & Maps — Which method applies a function element-wise?

a)

apply()

b)

map()

c)

transform()

d)

filter()

24.

Section C: Summary Functions & Maps — Series.map() is used to:

a)

Aggregate values

b)

Sort values

c)

Apply a function element-wise

d)

Group data

25.

Section C: Summary Functions & Maps — Which function gives correlation matrix?

a)

df.corr()

b)

df.cov()

c)

df.compare()

d)

df.relate()

26.

Section C: Summary Functions & Maps — What does df.value_counts() do?

a)

Counts columns

b)

Counts rows

c)

Counts unique values

d)

Counts nulls

27.

Section C: Summary Functions & Maps — Which function shows non-null counts and dtypes?

a)

df.describe()

b)

df.info()

c)

df.head()

d)

df.dtypes()

28.

Section C: Summary Functions & Maps — What does df.idxmax() return?

a)

Maximum value

b)

Index of maximum value

c)

Mean value

d)

Boolean mask

29.

Section C: Summary Functions & Maps — Which function checks duplicates?

a)

df.isdup()

b)

df.duplicated()

c)

df.has_duplicates()

d)

df.repeat()

30.

Section C: Summary Functions & Maps — How to drop duplicates?

a)

df.remove_duplicates()

b)

df.drop_dups()

c)

df.drop_duplicates()

d)

df.unique()

31.

Section D: Grouping & Sorting — Which function groups data?

a)

df.cluster()

b)

df.groupby()

c)

df.aggregate()

d)

df.split()

32.

Section D: Grouping & Sorting — groupby() is usually followed by?

a)

sort()

b)

apply() / aggregation

c)

filter() only

d)

join()

33.

Section D: Grouping & Sorting — Which is a valid aggregation?

a)

mean()

b)

sum()

c)

count()

d)

All of the above

34.

Section D: Grouping & Sorting — What does df.sort_values() sort by default?

a)

Index

b)

Rows

c)

Column values

d)

Datatypes

35.

Section D: Grouping & Sorting — Which sorts by index?

a)

df.sort()

b)

df.sort_index()

c)

df.order()

d)

df.reindex()

36.

Section D: Grouping & Sorting — What does ascending=False do?

a)

Sort ascending

b)

Sort descending

c)

Remove NaNs

d)

Reverse index only

37.

Section D: Grouping & Sorting — Which function returns group sizes?

a)

groupby().len()

b)

groupby().count()

c)

groupby().size()

d)

groupby().shape()

38.

Section D: Grouping & Sorting — agg() is used to:

a)

Rename columns

b)

Apply multiple aggregations

c)

Filter groups

d)

Join DataFrames

39.

Section D: Grouping & Sorting — What does reset_index() do?

a)

Drops columns

b)

Converts index to column

c)

Deletes index

d)

Renames index

40.

Section D: Grouping & Sorting — Which returns top N rows?

a)

df.head(n)

b)

df.top(n)

c)

df.limit(n)

d)

df.take(n)

41.

Which detects missing values?

a)

df.isna()

b)

df.isnan()

c)

df.hasna()

d)

df.checkna()

42.

Which fills missing values?

a)

df.fill()

b)

df.fillna()

c)

df.replace()

d)

df.complete()

43.

What does df.dropna() do?

a)

Fills NaNs

b)

Drops NaN rows

c)

Converts NaNs

d)

Replaces NaNs

44.

Which converts column datatype?

a)

df.astype()

b)

df.convert()

c)

df.type()

d)

df.cast()

45.

Which combines DataFrames vertically?

a)

merge()

b)

join()

c)

concat(axis=0)

d)

append_index()

46.

Which combines on a key column?

a)

concat()

b)

merge()

c)

stack()

d)

bind()

47.

Default join type in merge()?

a)

Left

b)

Right

c)

Inner

d)

Outer

48.

Which reshapes data from wide to long?

a)

pivot()

b)

melt()

c)

stack()

d)

reshape()

49.

Which reshapes long to wide?

a)

melt()

b)

groupby()

c)

pivot()

d)

explode()

50.

Which explodes list-like column entries?

a)

expand()

b)

explode()

c)

flatten()

d)

unpack()