
Pandas ADSC Practice
Authored by Tejas Kalpathi
Computers
1st Grade
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following DataFrame, how would you sort it by City in ascending order and then by Age in descending order?
df.sort_values(by='City').sort_values(by='Age', ascending=False)
df.sort_values(by=['City', 'Age'], ascending=[True, False])
df.sort(['City', 'Age'], ascending=[True, False])
df.sort_values(by=['City', 'Age'], ascending=[False, True])
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you filter the DataFrame to select rows where Age is greater than 25 or City is 'Chicago'?
df[(df['Age'] > 25) & (df['City'] == 'Chicago')]
df[(df['Age'] > 25) | (df['City'] == 'Chicago')]
df.query('Age > 25 and City == "Chicago"')
df[df['Age'] > 25 and df['City'] == 'Chicago']
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following DataFrame, how would you increase each employee's Salary by 10%?
df['Salary'] *= 1.10
df['Salary'] = df['Salary'] + 10000
df['Salary'] = df['Salary'].apply(lambda x: x * 1.10)
df['Salary'].update(df['Salary'] * 1.10)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you drop the Age column from the DataFrame permanently?
df = df.drop('Age', axis=1)
df.drop(columns='Age', inplace=True)
df.remove('Age')
del df['Age']
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following DataFrame, how would you fill missing values in the Age column with the mean age?
df['Age'].fillna(df['Age'].mean(), inplace=True)
df.fillna(df.mean(), inplace=True)
df['Age'] = df['Age'].replace(np.nan, df['Age'].mean())
df['Age'] = df['Age'].interpolate()
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you select only the Name and Salary columns from the DataFrame?
df[['Name', 'Salary']]
df.loc[:, ['Name', 'Salary']]
df.iloc[:, [0, 2]]
All of the above
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you rename the column Salary to Income?
df.rename(columns={'Salary': 'Income'}, inplace=True)
df.columns = ['Name', 'Income']
df.set_axis(['Name', 'Income'], axis=1, inplace=True)
df.rename_axis(columns='Income')
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
16 questions
Technology Systems
Quiz
•
1st - 5th Grade
25 questions
Roblox Level 1 Revision (English Version)
Quiz
•
1st Grade
16 questions
Linux2 - Quizz 5 -bash scripting
Quiz
•
1st - 5th Grade
15 questions
Budget Management Spreadsheet Quiz
Quiz
•
1st Grade
15 questions
Data Structures Quiz
Quiz
•
1st Grade
20 questions
Confidentiality and Information Security Quiz
Quiz
•
1st Grade
18 questions
Finding Your Work Experience Placement
Quiz
•
1st Grade
15 questions
ความปลอดภัยทางอินเทอร์เน็ต
Quiz
•
KG - 2nd Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
Discover more resources for Computers
20 questions
Telling Time to the Hour and Half hour
Quiz
•
1st Grade
10 questions
Life Cycle of a Frog
Quiz
•
1st - 2nd Grade
10 questions
Exploring Rosa Parks and Black History Month
Interactive video
•
1st - 5th Grade
20 questions
Place Value
Quiz
•
KG - 3rd Grade
10 questions
100th Day of School 1st/2nd
Quiz
•
1st - 2nd Grade
15 questions
Reading Comprehension
Quiz
•
1st - 5th Grade
10 questions
Identifying Physical and Chemical Changes
Interactive video
•
1st - 5th Grade
10 questions
Exploring the American Revolution
Interactive video
•
1st - 5th Grade