wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Data Wrangling 01

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What function would you use to create a NumPy array filled with zeros?

a)
  • a) np.zeros()

b)

b) np.empty()

c)

c) np.ones()

d)

d) np.array()

2.

Which function would you use to read a CSV file into a DataFrame?

a)
  • a) pd.read_table()

b)

b) pd.read_excel()

c)

c) pd.read_csv()

d)

d) pd.read_json()

3.

How can you display the first five rows of a DataFrame?

a)
  • a) df.first

b)

b) df.head()

c)

c) df.tail()

d)

d) df.sample()

4.

How do you drop a column named 'Age' from a DataFrame df?

a)
  • a) df.drop_column('Age')

b)

b) df.remove('Age')

c)

c) df.drop('Age', axis=1)

d)

d) df.delete('Age')

5.

What method is used to check for missing values in a DataFrame?

a)
  • a) df.isna()

b)

b) df.isnull()

c)

c) df.check_na()

d)

d) Both a and b

6.

Which method is used to concatenate two DataFrames vertically?

a)
  • a) pd.concat([df1, df2], axis=1)

b)

b) pd.merge([df1, df2])

c)

c) pd.concat([df1, df2], axis=0)

d)

d) pd.join([df1, df2])

7.

Which function will you use to merge two DataFrames on a common column?

a)
  • a) pd.concat()

b)

b) pd.append()

c)

c) pd.merge()

d)

d) pd.join()

8.

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

a)
  • a) df.filter('column > 10')

b)

b) df.query('column > 10')

c)

c) df[df['column'] > 10]

d)

d) Both B and C

9.

How do you filter rows in a DataFrame where the values in the column 'Age' are greater than 30?

a)
  • a) df.filter(df['Age'] > 30)

b)

b) df.query('Age > 30')

c)
  • c) df[df.Age > 30]

d)

d) Both b and c

10.

How can you filter rows in a DataFrame where the column 'town' is either 'BEDOK' or 'ANG MO KIO'?

a)
  • a) df[df['town'] in ['BEDOK', 'ANG MO KIO']]

b)

b) df[df['town'].isin(['BEDOK', 'ANG MO KIO'])]

c)

c) df("town == 'BEDOK' == 'ANG MO KIO'")

d)

d) Both b and c