Search Header Logo

Quiz for Week 09!

Authored by Liang Vivian

Computers

University

Used 2+ times

Quiz for Week 09!
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How do you rename the "Age" column to "Years" in a DataFrame df?

A) df.rename(columns={"Age": "Years"}, inplace=True)
B) df.columns = ["Years"]
C) df.columns.rename("Age", "Years")
D) df.rename_column("Age", "Years")

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

If a DataFrame df has some rows with missing values, how can you remove these rows?

A) df.remove_na()
B) df.delete_na(inplace=True)
C) df.dropna(inplace=True)
D) df.clean_na()

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How do you sort a DataFrame df by the "Age" column in descending order?

A) df.sort_values("Age", ascending=False)
B) df.sort(column="Age", descending=True)
C) df.order_by("Age", reverse=True)
D) df.arrange("Age", ascending=False)

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

If you want to reset the index of df and drop the existing index, which command should you use?

A) df.reset_index()
B) df.index.reset(drop=True)
C) df.reset_index(drop=True, inplace=True)
D) df.index.reset()

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How do you group the data in df by the "City" column and calculate the mean "Age" for each city?

A) df.groupby("City").Age.mean()
B) df.group_by("City").mean("Age")
C) df.groupby(["City"], mean("Age"))
D) df.group("City").average("Age")

Access all questions and much more by creating a free account

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

Already have an account?