Get Membership To Play All Videos In This Website.
Sign-in
Sign-up
Regular
Python
Membership
DataEngineering
Basics
Video Courses
Python and AWS Basics
AWS Realtime Projects
Online Tests
Online Test
Interview Questions
Online Store
Python Blog
Online Test
1). How can you perform a left join between two DataFrames 'df1' and 'df2' on a column 'key'??
A) df1.merge(df2, on='key', how='left')
B) df1.join(df2, on='key', how='left')
C) df1.concat(df2, on='key', how='left')
D) df1.append(df2, on='key', how='left')
2). Which method is used to change the data type of a DataFrame column??
A) astype()
B) convert()
C) change_type()
D) cast()
3). How can you calculate the rolling mean of a column 'sales' with a window size of 3??
A) df['sales'].rolling(window=3).mean()
B) df['sales'].rolling(window=3).average()
C) df['sales'].mean(window=3)
D) df['sales'].average(window=3)
4). How do you drop rows with missing values in a DataFrame??
A) dropna()
B) remove_na()
C) drop_missing()
D) discard_na()
5). Which method is used to get the unique values in a DataFrame column??
A) unique()
B) distinct()
C) get_unique()
D) unique_values()
6). How can you group a DataFrame by a column 'category' and calculate the mean of 'value' for each group??
A) df.groupby('category')['value'].mean()
B) df.group_by('category').mean('value')
C) df.groupby('category').mean('value')
D) df.aggregate('category', 'mean', 'value')
7). What method would you use to pivot a DataFrame with columns 'index', 'columns', and 'values'??
A) pivot()
B) pivot_table()
C) reshape()
D) transform()
8). How can you concatenate two DataFrames 'df1' and 'df2' along columns??
A) pd.concat([df1, df2], axis=1)
B) pd.merge([df1, df2], axis=1)
C) pd.append([df1, df2], axis=1)
D) pd.join([df1, df2], axis=1)
9). How can you handle missing values by filling them with a specified value in a DataFrame??
A) fillna(value)
B) replace_na(value)
C) impute(value)
D) setna(value)
10). Which method would you use to get a summary of the DataFrame's columns and their data types??
A) info()
B) describe()
C) summary()
D) columns()
11). How can you apply a function to each row of a DataFrame??
A) apply(func, axis=1)
B) map(func, axis=1)
C) apply_func(func, axis=1)
D) transform(func, axis=1)
12). What method is used to remove a column from a DataFrame??
A) drop()
B) remove()
C) discard()
D) delete()
13). How can you set a column 'date' as the index of a DataFrame??
A) df.set_index('date')
B) df.change_index('date')
C) df.index('date')
D) df.index_col('date')
14). How do you calculate the cumulative sum of a DataFrame column 'amount'??
A) cumsum()
B) cum_sum()
C) total_sum()
D) accumulate()
15). How can you check for duplicates in a DataFrame??
A) duplicated()
B) check_duplicates()
C) find_duplicates()
D) drop_duplicates()
16). What function is used to merge DataFrames based on a common index??
A) join()
B) merge()
C) combine()
D) concatenate()
17). How do you save a DataFrame to a CSV file??
A) to_csv()
B) save_csv()
C) export_csv()
D) write_csv()
18). How can you group data by multiple columns and calculate the sum of another column??
A) df.groupby(['col1', 'col2'])['value'].sum()
B) df.group_by(['col1', 'col2']).sum('value')
C) df.groupby(['col1', 'col2']).aggregate('value', 'sum')
D) df.aggregate(['col1', 'col2'], 'sum', 'value')
19). How can you pivot a DataFrame with 'index' and 'values' but no 'columns'??
A) pivot(index='index', values='values')
B) pivot_table(index='index', values='values')
C) reshape(index='index', values='values')
D) transform(index='index', values='values')
20). What method is used to sort a DataFrame by multiple columns??
A) sort_values()
B) order_by()
C) sort()
D) arrange()
21). How do you extract a substring from a DataFrame column 'text'??
A) str.slice()
B) str.extract()
C) str.substring()
D) str.sub()
22). How can you compute the correlation matrix of a DataFrame??
A) corr()
B) correlation()
C) compute_corr()
D) correlation_matrix()
23). What method is used to reset the index of a DataFrame and move the current index to a column??
A) reset_index()
B) set_index()
C) reindex()
D) index_reset()
24). How can you filter rows where the value of 'score' is between 50 and 100??
A) df[(df['score'] >= 50) & (df['score'] <= 100)]
B) df[df['score'].between(50, 100)]
C) df[df['score'] > 50 & df['score'] < 100]
D) df.query('50 <= score <= 100')
Submit
Test Results