Um momento
0x10Lesson 2 of 5

Inspect and clean a dataset

Check values, missing entries, and types before calculating.

12 min 3-question quiz 1 code exercise
By the end of this lesson you can
  • Summarize a small dataset and handle missing values deliberately.

Before analysis, inspect the shape, field names, value types, ranges, and missing values. Missing does not mean zero: it may mean unknown, not recorded, or not applicable. Choose a handling rule that fits the question, and record that choice. Also check for duplicates, inconsistent units, and values outside plausible ranges.

analysis.py
1scores = [82, None, 91, 77]
2known = [score for score in scores if score is not None]
3print("rows:", len(scores))
4print("known:", len(known))
Output
rows: 4
known: 3

A quick summary can expose data quality issues, but it does not replace understanding how the data was collected. Avoid silently dropping records if missingness may be related to the outcome.

Key takeaways

  • Summarize a small dataset and handle missing values deliberately.

  • Check how the data was collected before drawing conclusions.

  • Explain important assumptions and limitations.

Lesson quiz

3 questions · pass with 3 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Practice: write Python

Write Python in the editor and run it against sample inputs. Python runs locally in your browser using a WebAssembly runtime.

Exercise 1

Average known values

+25 XP

Read a JSON array of numbers and null values. Print the average of the known numbers. The input has at least one known number.

  • One missing score
  • No missing values
main.py
Loading editor…

Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Gostou da aula? 😆👍
Apoie nosso trabalho com uma doação: