Pandas ADSC Practice

Pandas ADSC Practice

1st Grade

20 Qs

quiz-placeholder

Similar activities

Base de Datos para Aplicaciones U1

Base de Datos para Aplicaciones U1

1st Grade

22 Qs

Dash Robot Quiz

Dash Robot Quiz

1st Grade

18 Qs

Competition_Formakt_Final

Competition_Formakt_Final

1st Grade

20 Qs

Internet Safety

Internet Safety

KG - 3rd Grade

20 Qs

TestTime2

TestTime2

1st - 3rd Grade

15 Qs

Mentoring1 CompTia Network+

Mentoring1 CompTia Network+

1st - 10th Grade

20 Qs

Nextech_08

Nextech_08

1st - 3rd Grade

15 Qs

Let's test your typing & keyboard skills

Let's test your typing & keyboard skills

1st - 2nd Grade

18 Qs

Pandas ADSC Practice

Pandas ADSC Practice

Assessment

Quiz

Computers

1st Grade

Hard

Created by

Tejas Kalpathi

Used 2+ times

FREE Resource

AI

Enhance your content

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

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

Media Image

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

Media Image

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

Media Image

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

Media Image

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

Media Image

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

Media Image

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')

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?