Types of Data
Data is classified along several independent axes. Every axis matters, because the type of data decides which statistical measure and which chart is valid. Using a mean on nominal data or a pie chart on continuous data is a classic mistake.
1. Classification by Structure
| Type | Description | Storage | Examples | Share of world data |
|---|---|---|---|---|
| Structured | Fixed schema; organised in rows and columns | Relational databases (SQL), spreadsheets | Bank transactions, student records, sensor logs | ~20% |
| Semi-structured | Has tags/markers giving partial structure but no rigid schema | NoSQL, files | JSON, XML, emails, log files | ~10% |
| Unstructured | No predefined model or organisation | Data lakes, object storage | Images, video, audio, free text, social media posts | ~70–80% |
# STRUCTURED — every record has the same fields
students = [
{"roll": 101, "name": "Riya", "marks": 88},
{"roll": 102, "name": "Zoya", "marks": 76},
]
# SEMI-STRUCTURED — JSON: self-describing, but records may differ
order = {
"id": "ORD-9012",
"items": [{"sku": "A1", "qty": 2}, {"sku": "B7", "qty": 1}],
"gift_wrap": True # this key may be absent in other orders
}
# UNSTRUCTURED — free text; no fields at all
review = "Delivery was quick but the packaging was torn on one side."
2. Classification by Nature
Qualitative (Categorical) data describes qualities or categories — it labels rather than measures.
Quantitative (Numerical) data describes quantities — it can be counted or measured, and arithmetic on it is meaningful.
| Qualitative | Quantitative | |
|---|---|---|
| Also called | Categorical | Numerical |
| Answers | "What kind?" | "How much / how many?" |
| Arithmetic valid? | No | Yes |
| Sub-types | Nominal, Ordinal | Discrete, Continuous |
| Examples | Gender, blood group, city, course | Age, marks, salary, temperature |
| Typical charts | Bar chart, pie chart | Histogram, box plot, line chart |
Discrete vs Continuous:
| Discrete | Continuous | |
|---|---|---|
| Values | Countable, whole, finite gaps between values | Any value in a range, infinitely divisible |
| Obtained by | Counting | Measuring |
| Examples | Number of students, cars sold, defects found | Height, weight, time, temperature |
| Can be fractional? | No (2.5 students is meaningless) | Yes (2.5 kg is meaningful) |
3. Classification by Measurement Scale — NOIR
This is the most examined classification. Remember the mnemonic NOIR: Nominal, Ordinal, Interval, Ratio.
| Scale | Order? | Equal intervals? | True zero? | Valid operations | Examples |
|---|---|---|---|---|---|
| Nominal | ✗ | ✗ | ✗ | =, ≠, counting, mode | Gender, blood group, PIN code, religion |
| Ordinal | ✓ | ✗ | ✗ | Above + <, >, median, percentile | Ranks (1st/2nd), Likert scale, grades A/B/C |
| Interval | ✓ | ✓ | ✗ | Above + +, −, mean, SD | Temperature in °C/°F, calendar dates, IQ score |
| Ratio | ✓ | ✓ | ✓ | Above + ×, ÷, all statistics | Height, weight, income, age, marks, distance |
Why "true zero" matters: 40 °C is not "twice as hot" as 20 °C, because 0 °C is an arbitrary reference point, not an absence of temperature — so temperature in Celsius is interval. But ₹40,000 is exactly twice ₹20,000, because ₹0 means genuinely no money — so income is ratio.
import pandas as pd
df = pd.DataFrame({
"student": ["Riya", "Zoya", "Kabir", "Aarav"], # Nominal
"grade": ["A", "B", "A", "C"], # Ordinal
"temp_c": [36.8, 37.2, 36.5, 38.1], # Interval
"marks": [88, 76, 91, 54], # Ratio
})
print(df["student"].mode()[0]) # nominal -> mode only
print(df["grade"].value_counts()) # ordinal -> counts/median rank
print(df["marks"].mean()) # ratio -> mean is valid: 77.25
# df["student"].mean() -> MEANINGLESS: never average a nominal column
4. Classification by Source
| Type | Meaning | Collected by | Cost & time | Examples |
|---|---|---|---|---|
| Primary data | Collected first-hand for the current problem | The analyst/researcher themselves | High | Surveys, interviews, experiments, observations, sensor readings |
| Secondary data | Already collected by someone else, reused | Third party | Low | Census reports, Kaggle datasets, government open data, company archives |
5. Other Important Data Types in Analytics
| Type | Description | Example |
|---|---|---|
| Time-series data | Observations indexed in time order | Daily stock prices, hourly temperature |
| Cross-sectional data | Many subjects observed at a single point in time | Marks of all students in one exam |
| Panel (longitudinal) data | Many subjects observed over multiple time points | Yearly income of 500 families over 10 years |
| Spatial / geospatial data | Data tied to geographic location | GPS traces, delivery heat maps |
| Metadata | "Data about data" | Image resolution, file creation date, column data types |
| Big data | Volume/velocity/variety beyond conventional tools | Social media firehose, IoT sensor streams (Unit 4) |
Choosing Techniques by Data Type
| Data type | Valid central tendency | Typical visualization | Typical model (Unit 3) |
|---|---|---|---|
| Nominal | Mode | Bar chart, pie chart | Classification |
| Ordinal | Mode, median | Ordered bar chart | Classification / ordinal regression |
| Interval | Mode, median, mean | Histogram, line chart | Regression |
| Ratio | All, plus geometric mean | Histogram, box plot, scatter | Regression, clustering |
Getting this classification right in the first lesson of a project saves an enormous amount of rework later — it determines your cleaning strategy (Unit 1), your summary statistics and charts (Unit 2), and even which algorithm can legally consume the column (Unit 3).