Welcome to the quiz! Please read the following rules carefully before you begin:
Total Questions: The quiz consists of 10 questions.
No Time Limit: There is no time limit for completing the quiz. Take your time to think through each question.
Changing Answers: You are allowed to change your answers at any time before submitting the quiz.
Results: You will be able to see your results immediately after completing the quiz. This will include your score and the correct answers.
1.
Which method can be used to convert a DataFrame index to a column?
2.
What will be the output of the following code?
import pandas as pd
df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
df['C'] = df['A'] + df['B']
df['D'] = df['C'].apply(lambda x: x**2)
df.loc[1, 'D'] = None
print(df)
3.
Which of the following functions can be used to concatenate two DataFrames along the columns?
4.
What does the pd.Grouper() function do when used in a groupby operation?
5.
When merging two DataFrames with different indexes, what parameter can you set to specify the index to merge on?
6.
If you want to perform a pivot operation on a DataFrame with multi-level columns, which method would you use?
7.
Which method is used to get the quantiles of a DataFrame?
8.
What will the following code output?
df = pd.DataFrame({'A': [1, 2, 3, 4, 5], 'B': [5, 4, 3, 2, 1]})
print(df[df['A'] > 2]['B'].max())
9.
What does the df.drop_duplicates() method do?
10.
If you want to replace all occurrences of a specific value in a DataFrame with another value, which method would you use?
11.
Which of the following is true about the DataFrame.apply() method?
12.
How can you find the correlation between all numeric columns in a DataFrame?
13.
What will happen if you attempt to merge two DataFrames without any common column keys and without specifying how to merge?
14.
What is the result of using df.sort_values(by='A', ascending=False) on a DataFrame df?
15.
If you want to perform a left join on two DataFrames df1 and df2 based on a common key column named 'key', which of the following is correct?
Leave a Reply