Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 57 ยท Getting Started

Types of Data

Understand qualitative and quantitative data, discrete and continuous variables, and the four measurement scales that decide which statistics and charts make sense.

Before you compute anything, ask what kind of data you have. The type of a variable decides which summaries are meaningful, which charts are honest and which tests are allowed. An average of zip codes is a number, but it means nothing; an average of heights tells you something real. This lesson gives you the map.

Variables and observations

A variable is a characteristic that can differ from one individual to another (height, favorite color, number of siblings). An observation is one individual's value for it. A dataset is usually a table: each row is an observation (a person, a purchase, a day) and each column is a variable.

name age city rating
Ana 24 Lima 5
Ben 31 Oslo 3
Chi 29 Hanoi 4

Here age is numeric, city is a label and rating is a number that is really a rank. Each column needs its own treatment.

Qualitative (categorical) data

Qualitative data places individuals into categories. There are two kinds:

  • Nominal: categories with no natural order: blood type, country, car brand, yes/no. You can count them and find the most common one (the mode), but you cannot average them.
  • Ordinal: categories with a meaningful order but no reliable distance between them: shirt size (S, M, L), satisfaction (poor, fair, good), education level. The gap between "good" and "excellent" need not equal the gap between "poor" and "fair".

Quantitative (numerical) data

Quantitative data are numbers on which arithmetic makes sense.

  • Discrete: counted values with gaps: number of children, goals in a match, emails per day. Usually whole numbers.
  • Continuous: measured values that can take any value in a range: height, time, temperature, weight. Any recorded precision is a rounding of an underlying real number.
flowchart TD
    D["Data"] --> QL["Qualitative"]
    D --> QN["Quantitative"]
    QL --> N["Nominal<br/>no order"]
    QL --> O["Ordinal<br/>ordered"]
    QN --> DI["Discrete<br/>counted"]
    QN --> C["Continuous<br/>measured"]

Four everyday types; the next section refines the numeric ones with scales.

Levels of measurement

Psychologist Stanley Stevens grouped data into four scales. Each level adds a property to the one before.

Scale Property added Example Sensible summaries
Nominal Labels only Blood type Counts, mode
Ordinal Order Race finishing place Median, percentiles
Interval Equal differences, no true zero Temperature in Celsius, calendar year Mean, standard deviation
Ratio True zero, ratios make sense Height, income, duration Everything, including ratios

Why does the true zero matter? 20 degrees Celsius is not "twice as warm" as 10 degrees, because 0 Celsius is an arbitrary point. Kelvin has a real zero, so 200 K is twice the thermal energy of 100 K. A weight of 80 kg really is twice 40 kg.

Climbing the measurement ladder

Nominal Names only
Ordinal Names + order
Interval Equal gaps
Ratio True zero

Higher levels allow more math.

1 / 2

Checking types in code

Real data often hides its type. A rating column stored as numbers 1 to 5 is ordinal, yet a program will happily average it. The next example classifies columns and shows which summary fits.

Python Which summary fits which type?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Python computes the mean shirt size without complaint, but 2.29 is not a shirt size. The tool does not know the scale, you do.

Numbers that are really labels

A column of digits is not necessarily quantitative. Phone numbers, zip codes, product IDs and jersey numbers are nominal labels. Summing or averaging them is meaningless. Conversely, a text column such as "10 kg" may hold quantitative data that needs parsing.

Python Spot the label disguised as a number

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Other useful distinctions

  • Cross-sectional vs time series: many individuals at one moment, versus one individual over time (daily temperature).
  • Univariate, bivariate, multivariate: one, two or many variables studied together.
  • Primary vs secondary: data you collect yourself versus data someone else collected.
  • Structured vs unstructured: tables versus text, images and audio.

Why the type drives the method

Question Nominal Ordinal Numeric
Typical value Mode Median Mean or median
Spread None Range or IQR Standard deviation
Chart Bar chart Ordered bar chart Histogram, box plot

You will use this table throughout the next chapter on describing data.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which variable is ordinal?

    The categories have an order, but the distance between them is not defined.
  2. 2. Temperature in Celsius belongs to which scale?

    Differences are meaningful, but zero is arbitrary, so ratios are not.
  3. 3. The number of cars passing a gate each hour is...

    It is a count, so it takes whole values with gaps between them.
  4. 4. Why is averaging zip codes pointless?

    Arithmetic on identifiers has no real-world meaning, even though the program computes it.

Summary

  • Qualitative data is nominal or ordinal; quantitative data is discrete or continuous.
  • The four scales (nominal, ordinal, interval, ratio) add properties step by step.
  • Only ratio data allows meaningful statements like "twice as much".
  • Digits do not guarantee quantity: IDs and zip codes are labels.
  • The data type tells you which summaries and charts are honest.

Next: Population vs Sample