Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Cleaning Survey Data | Data Manipulation for Research
Python for Researchers

bookChallenge: Cleaning Survey Data

Uppgift

Swipe to start coding

You are provided with a DataFrame containing survey responses, where some values in the 'age' and 'score' columns are missing. Your task is to implement a function that fills missing values in the 'age' column with the median age, and missing values in the 'score' column with the mean score. The function should return the cleaned DataFrame.

  • Fill missing values in the 'age' column with the median of the 'age' column.
  • Fill missing values in the 'score' column with the mean of the 'score' column.
  • Return the resulting DataFrame.

Lösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 7
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

Suggested prompts:

Can you explain this in simpler terms?

What are the main benefits or drawbacks?

Can you give me a real-world example?

close

bookChallenge: Cleaning Survey Data

Svep för att visa menyn

Uppgift

Swipe to start coding

You are provided with a DataFrame containing survey responses, where some values in the 'age' and 'score' columns are missing. Your task is to implement a function that fills missing values in the 'age' column with the median age, and missing values in the 'score' column with the mean score. The function should return the cleaned DataFrame.

  • Fill missing values in the 'age' column with the median of the 'age' column.
  • Fill missing values in the 'score' column with the mean of the 'score' column.
  • Return the resulting DataFrame.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 7
single

single

some-alt