Q&A 17 What is the difference between categorical and numerical variables?

17.1 Explanation

In data analysis, variables are typically classified into two major types:

17.1.1 🔷 Categorical Variables

These represent groups, labels, or categories. They describe qualities, not quantities.

  • Nominal: Categories with no natural order
    Example: "red", "blue", "green"

  • Ordinal: Categories with a meaningful order
    Example: "low", "medium", "high"

17.1.2 🔶 Numerical Variables

These represent measurable quantities and describe how much or how many.

  • Discrete: Countable, whole-number values
    Example: Number of children, cars, books

  • Continuous: Measurable on a scale; can take any value within a range
    Example: Height, weight, temperature


Correctly identifying variable types is critical. It informs the choice of: - Statistical methods (e.g., t-tests vs chi-squared tests) - Visualizations (e.g., histograms for continuous vs bar plots for categorical) - Feature encoding in machine learning (e.g., one-hot encoding for nominal variables)