NEW
Font size
WorksheetsData Wrangling 01
Total questions: 10
Worksheet time: 5mins
What function would you use to create a NumPy array filled with zeros?
a) np.zeros()
b) np.empty()
c) np.ones()
d) np.array()
Which function would you use to read a CSV file into a DataFrame?
How can you display the first five rows of a DataFrame?
a) df.first
b) df.head()
c) df.tail()
d) df.sample()
How do you drop a column named 'Age' from a DataFrame df?
a) df.drop_column('Age')
b) df.remove('Age')
c) df.drop('Age', axis=1)
d) df.delete('Age')
What method is used to check for missing values in a DataFrame?
a) df.isna()
b) df.isnull()
c) df.check_na()
d) Both a and b
Which method is used to concatenate two DataFrames vertically?
a) pd.concat([df1, df2], axis=1)
b) pd.merge([df1, df2])
c) pd.concat([df1, df2], axis=0)
d) pd.join([df1, df2])
Which function will you use to merge two DataFrames on a common column?
a) pd.concat()
b) pd.append()
c) pd.merge()
d) pd.join()
How can you filter rows of a DataFrame based on a condition in a column?
a) df.filter('column > 10')
b) df.query('column > 10')
c) df[df['column'] > 10]
d) Both B and C
How do you filter rows in a DataFrame where the values in the column 'Age' are greater than 30?
a) df.filter(df['Age'] > 30)
b) df.query('Age > 30')
c) df[df.Age > 30]
d) Both b and c
How can you filter rows in a DataFrame where the column 'town' is either 'BEDOK' or 'ANG MO KIO'?
a) df[df['town'] in ['BEDOK', 'ANG MO KIO']]
b) df[df['town'].isin(['BEDOK', 'ANG MO KIO'])]
c) df("town == 'BEDOK' == 'ANG MO KIO'")
d) Both b and c
