📘 CodingMarble Learn

Data Analysis

Data analysis means turning raw data into answers. It follows a cycle: ask a question, collect data, clean it (remove errors, repeats and blanks), organise and transform it, analyse it with summaries such as mean, median, range and patterns, show it with a good chart, and draw a careful conclusion. Watch for outliers, small samples and bias, and remember that a correlation between two things does not prove that one causes the other. Data must also be stored safely and used with permission.

🎬 Step-by-step story

  1. First we collect data. We ask 8 students how many hours they slept. Each answer is one ball in the box.
  2. Some answers are wrong: a repeat, an impossible '25 hours', a blank. Cleaning means we remove or fix them.
  3. Next we organise. We sort the answers from smallest to largest, and each one becomes a bar.
  4. Now we analyse. The mean adds all values and divides by how many there are. The median is the middle value.
  5. We draw a chart to see a pattern. More screen time goes with less sleep. But a pattern alone does not prove the cause.
  6. Your turn: add a new student with the slider. Try a huge value. See the mean jump while the median stays calm.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why not just use all data as it comes?

Raw data has repeats, typos and impossible values. One bad value can change the answer, so we clean first.

Why sort before finding the median?

The median is the middle of the ordered list. Without sorting, the middle position means nothing.

When should I use the median instead of the mean?

When there are outliers or the data is lopsided. Try a huge value in free play: the mean jumps, the median does not.

If the trend line goes down, does screen time cause less sleep?

It may, but the chart alone cannot prove it. Other things (homework, stress) might affect both.

Is qualitative data useless for analysis?

No. We can count categories, find the mode and draw bar or pie charts.

The data analysis cycle

  1. Ask a clear question ("Do students who use phones late sleep less?").
  2. Collect data: surveys, measurements, sensors, experiments or existing datasets.
  3. Clean the data.
  4. Organise / transform: sort, group, make tables, change units.
  5. Analyse: summaries, patterns, comparisons.
  6. Visualise and conclude: make a chart, answer the question, say how sure you are.

Often the answer raises a new question, so the cycle starts again. Tools range from paper and a calculator to spreadsheets and programming languages such as Python.

Collecting and cleaning data

Quantitative data are numbers (height 152 cm). Qualitative data are words or categories (favourite sport). Primary data you collect yourself; secondary data someone else collected.

A sample is the group you actually ask. A bigger, randomly chosen sample gives fairer results; asking only your friends adds bias.

Cleaning checklist

Keeping data safe

Personal data needs permission, should be stored securely, and names can be removed (anonymised) before sharing.

Analysing data: averages, spread, outliers

Mean = sum of values ÷ number of values. Median = middle value after sorting (for an even count, the mean of the middle two). Mode = most common value. Range = largest − smallest; it shows spread.

An outlier is a value far from the rest. It can be a mistake or a real rare case. The mean is pulled by outliers; the median is not, so the median is better for skewed data such as incomes.

Exploratory data analysis means looking at data from many sides (tables, charts, summaries) before testing an idea. Grouping (for example by class or city) and combining several datasets can reveal new patterns.

Visualising, concluding and evaluating

Choose the chart for the job: bar chart to compare groups, line graph for change over time, scatter plot for two number variables, pie chart for parts of a whole, histogram for how values are spread.

In a scatter plot, points rising together show a positive correlation; one going up while the other goes down shows a negative correlation. Correlation is not causation: ice-cream sales and drownings both rise in summer because of heat, not because of each other.

Evaluate your conclusion

Was the sample big and fair? Were errors cleaned? Could another analysis of the same data give a different answer? State limits honestly. With big data (millions of rows, e.g. city air-pollution sensors), computers do the same steps faster, but the same care is needed.

Key formulas and definitions

Worked examples

1. Clean this sleep data: 7, 8, 8 (same student twice), 25, blank, 6.

Remove the duplicate 8, the impossible 25 and the blank. Clean data: 7, 8, 6.

2. Find the mean and median of 6, 7, 7, 8, 8, 8, 9, 10.

Sum = 63, count = 8, mean = 63 ÷ 8 = 7.875 ≈ 7.9. Middle two values are 8 and 8, so median = 8.

3. Add an outlier 24 to the data above. What happens to the mean and median?

New sum = 87, count = 9, mean = 87 ÷ 9 ≈ 9.67 (a big jump). Sorted, the 5th value is 8, so median = 8 (no change). The median resists outliers.

Common mistakes

Practice quiz

1. Which step removes repeats and impossible values?
2. The mean of 2, 4, 6 is:
3. Which average is least affected by an outlier?
4. Best chart for two number variables together:
5. "Favourite colour" is which kind of data?

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is data analysis in simple words?

Collecting information, cleaning and organising it, then using summaries and charts to answer a question.

What are the steps of data analysis?

Ask a question, collect, clean, organise, analyse, visualise and conclude, then evaluate.

What is the difference between mean and median?

The mean is the sum divided by the count; the median is the middle value. The median is not pulled by outliers.

Where this is taught

Canada (Ontario)Grade 8D. Data
Canada (Ontario)Grade 9A. Business Leadership, Project Management, and Connections
Canada (Ontario)Grade 10A. Business Leadership, Project Management, and Connections
Canada (Ontario)Grade 10B. Hardware, Software, and Innovations
Canada (Ontario)Grade 11Productivity Software
Canada (Ontario)Grade 11B. Spatial Geography: Concepts and Processes
Canada (Ontario)Grade 11B. Design, Layout, and Planning Skills
Canada (Ontario)Grade 11B. Computer Technology Skills
Canada (Ontario)Grade 11A. Computer Technology Fundamentals
Canada (Ontario)Grade 12B. Spatial Organization: Concepts and Processes
Canada (Ontario)Grade 12B. Spatial Organization: Regional Similarities and Differences
Canada (Ontario)Grade 12D. Data Management
Canada (Ontario)Grade 12C. Organization of Data for Analysis
Canada (Ontario)Grade 12D. Statistical Analysis
Canada (Ontario)Grade 12E. Culminating Data Management Investigation
Canada (Ontario)Grade 12A. Reasoning with Data
Canada (Ontario)Grade 12C. Mechanical Systems
Canada (Ontario)Grade 12B. Design, Layout, and Planning Skills
Canada (Ontario)Grade 12B. Design, Layout, and Planning Skills
Canada (Ontario)Grade 12A. Computer Technology Fundamentals
NetherlandsVWO 3 (onderbouw)Data and chance
NetherlandsHAVO 4 (bovenbouw, 2e fase)Statistics (part 1)
PolandSzkoła podstawowa, klasa VIICross-cutting skills
Spain2º ESOScientific project
Spain3º ESOScientific project
Spain4º ESOScientific project
Spain1º BachilleratoScientific project
Spain1º BachilleratoNumber sense
England (GCSE, A level)Year 9Working scientifically
USA (Common Core, NGSS, AP)Grade 8Data and Analysis
USA (Common Core, NGSS, AP)Grade 9Data and Analysis
USA (Common Core, NGSS, AP)Grade 10Big Idea 2: Data
USA (Common Core, NGSS, AP)Grade 10Big Idea 3: Algorithms and Programming
USA (Common Core, NGSS, AP)Grade 11Data Collections
USA (Common Core, NGSS, AP)Grade 11Data and Analysis
Japan高校(専門学科)1〜3年Advanced Mathematics I
South Korea중학교 2학년Data
South Korea고등학교 1학년Foundations of science
South Korea고등학교 1학년Processes of scientific inquiry
South Korea고등학교 2학년The process of convergent inquiry
South Korea고등학교 2학년Preparing and analysing data
South Korea고등학교 2학년Data science project
South Korea고등학교 2학년Data
South Korea고등학교 2학년Society and mathematics
South Korea고등학교 2학년Environment and mathematics
South Korea고등학교 2학년Software for analysis
South Korea고등학교 3학년Data and information
South Korea고등학교 3학년Data
Russia10 классInformation technologies
Russia11 классInformation technologies
China高一Comp.1 Ch.3 Data processing
China高二Sel.3 Data management and analysis

Learn first

Learn next

Related lessons

All Computer Science lessons