Skip to main content

Someone wanted to learn this too, so Grasp built them a personal learning path.

You can keep exploring this one or create your own

Classifying Dataset Field Types

Hello again. Last lesson, you turned “Are we spending too much?” into a measurable objective by specifying an expense measure, a department, a period, and a budget comparison. Before you can calculate an answer from a dataset, you need to recognize what each field means. A department name, an expense amount, and a transaction date may all appear side by side, but they play different roles in an analysis.

In this lesson, you’ll learn to classify fields as identifiers, categorical variables, numerical variables, or dates. The goal is to make sound choices about which fields identify records, define groups, supply quantities, and establish time periods. Allow about 35–40 minutes to work through the examples and short resources.


First, identify what each row describes

A dataset is easier to understand once you know its observation: the thing each row describes. In the employee spreadsheet below, each visible data row describes an employee. The columns record different facts about that employee, such as department, age, and hire date. In an expense dataset, a row might instead describe one transaction. You cannot reliably interpret a column until you know what its values refer to.

A sample employee spreadsheet. Each data row describes an employee; columns include an employee ID, department, age, hire date, annual salary, and other fields that serve different analytical roles.

Khan Academy’s short example uses beverages rather than employees. Watch for the distinction between the item described by a row and the fields used to describe it.

Identifying individuals, variables and categorical variables in a data set | Khan Academy

Watch “Identifying individuals, variables and categorical variables in a data set” from Khan Academy to see how the subject of a row differs from its identifying label and measured attributes.

In the subjects, notice that an “individual” in a dataset need not be a person. Continue through the fields, where the beverage label is distinguished from its type and numerical measurements. The label is still a field in the dataset, even though it is not a useful quantity to average.

Data Carpentry makes the same row-and-column distinction in the context of tables. Its brief explanation of data types is also useful, provided you keep storage type separate from analytical role.

Data Management with SQL for Social Scientists *alpha*: What is a relational database?

Read the “What is a table?” and “What is a data type?” sections from Data Carpentry to establish what rows and columns represent, then inspect a few examples of stored data types.

In “What is a table?”, read the row explanation. In “What is a data type?”, read the opening paragraph. Immediately below it, scan the first data-type table for the rows labelled Text, INTEGER, DECIMAL, and DATE; stop before “But in practice you can usually restrict your usage to a few.” Focus on what each can store, not on memorizing database terminology.

Here is the crucial distinction: how a field is stored is not necessarily what it means. An employee ID could be stored as text or as an integer; its analytical role is still to identify an employee. A date could be displayed in several formats; its role is still to locate an event in time. Classification starts with meaning, not just appearance.


Four roles a field can play

An identifier tells you which person, item, or record you are looking at. In the image, EEID is an employee identifier. Whether its characters happen to include digits is beside the point: adding or averaging employee IDs would not describe the workforce. A good identifier distinguishes records at the level you need. Full Name is also an identifying label, but two employees can share a name, so it is not a dependable unique identifier on its own.

A categorical variable places an observation into a group or gives it a label. Department might contain IT, Sales, or Finance. Country and Job Title are also categories. Category values do not have to be words: a department represented by code 10 is still a category if 10 means “Finance.” Some categories have a meaningful order, such as junior, mid-level, and senior; others, such as department names, do not. In either case, the values represent groups rather than measured amounts.

A numerical variable records a quantity for which numerical operations have a sensible interpretation. In the spreadsheet, Annual Salary, Age, and Bonus % are numerical fields. You could compare salaries, calculate an average age, or examine bonus percentages. Pay attention to units: a salary shown with a dollar sign is an amount of money, while Bonus % is a rate. Both are numerical, but they should not be treated as interchangeable quantities.

A date field records when something occurred or marks a point in time. Hire Date tells you when an employee joined; Exit Date indicates when an exit occurred, if a date is recorded. Dates support questions about periods and elapsed time. They are not ordinary quantities to sum, even if spreadsheet software stores them internally as numbers. A blank exit-date cell means no exit date is recorded in that cell; without further information, it does not prove why it is blank.

The Stats and R reading reinforces the distinction most likely to cause trouble: a value made of digits is not automatically a numerical measure.

Variable types and examples - Stats and R

Read the focused passages in “Variable types and examples” from Stats and R to see why analytical meaning matters more than whether a value looks numeric.

In “Qualitative,” read the category definition. Then go to “Additional notes,” under “Misleading data encoding,” and read the encoding examples. Notice separately why a numbered category and a student ID should not be analyzed as measured quantities.

A practical test is to ask: Would arithmetic on these values answer a meaningful question? Averaging annual salaries might. Averaging employee IDs or numeric department codes would not. This test is useful, though it is not the whole classification: a date also permits certain calculations, such as elapsed time, without becoming a salary-like numerical measure.


Classify the employee spreadsheet

Now return to the image. The following classification accounts for every visible column header, using each field’s main role in this dataset.

Main role Fields in the employee spreadsheet What they contribute
Identifier or identifying label EEID; Full Name Identifies or names the employee. Use EEID rather than assuming names are unique.
Categorical Job Title, Department, Business Unit, Gender, Ethnicity, Country, City Describes groups or labels that can be used to compare sets of employees.
Numerical Age, Annual Salary, Bonus % Supplies measured amounts, counts of years, or rates.
Date Hire Date, Exit Date Locates employment events in time.

Notice that classification is about the field, not a judgement about whether every cell is valid. A missing Exit Date does not turn the column into a categorical variable. Similarly, if one salary cell accidentally contains text, Annual Salary is still intended to be numerical, though the entry would need investigation before calculation. You will look more closely at such data-quality problems later in the module.

The table also shows why a field’s purpose may be more precise than a broad label. Full Name contains text and could technically be used to group matching names. In this employee dataset, however, its primary purpose is to label a person, not to define a business group like Department. Calling it an identifying label captures that purpose without claiming it uniquely identifies a row.


Let the business question guide your use of the fields

Recall the previous lesson’s question about whether the Sales department exceeded its operating-expense budget. Imagine an expense dataset with fields called Expense ID, Department, Expense Date, Actual Expense, and Approved Budget. Before doing any calculation, you can assign their roles:

Expense ID identifies a record. Department identifies the group to include—Sales. Expense Date determines which records fall in January–March 2025. Actual Expense and Approved Budget are the quantities needed for the comparison. Merely having all five fields is not enough to guarantee a valid analysis; you would still need to check that the budget figures match the same scope and period. But classification tells you what each field can contribute to the objective.

This is a recurring habit in data science: decide whether a field is a record label, a grouping variable, a quantity, or a time marker before choosing a calculation. It prevents mistakes such as averaging codes, summing dates, or treating a category label as though it measured magnitude. It also helps you recognize a missing ingredient. If an expense file has amounts and dates but no department field, you cannot directly isolate Sales expenses from that file alone.


Takeaway

Classify fields by what their values mean, not only by how they look or how software stores them. Identifiers distinguish records; categorical variables describe groups; numerical variables measure quantities; dates locate events in time. One field can require a little judgement—especially names and numeric-looking codes—but its intended use and the observation described by each row usually resolve the question.

Next, you’ll build on this understanding by restructuring a small dataset so that each row represents one observation and each column represents one variable.

Can't find a good explanation? Sign up and we'll make it for you

Sign up