Pie chart glossary · Updated November 25, 2026 by Ryan Doyle, who built Pie Chart Generator.

What Is Categorical Data?

Categorical data puts each observation into one of a set of named groups, such as eye color, country or yes/no, instead of measuring it on a number scale. You can count how many fall in each group and find the most common one, but you can't take a mean. Those counts are what a pie chart or bar chart shows.

Types of categorical data

Categorical data comes in two main kinds, nominal and ordinal. A variable with only two groups is called binary (or dichotomous); it is usually treated as nominal.

TypeDo the groups have an order?ExamplesPie chart?
NominalNoEye color, blood type, favorite fruit, country, file formatYes, when each item is in exactly one group
OrdinalYesT-shirt size (S, M, L), strongly disagree to strongly agree, school yearUsually a bar chart in order is clearer; a pie hides the order
BinaryUsually no, two groupsYes or no, pass or fail, owns a car or notYes, a 2-slice pie or a single percentage

Categorical vs numerical data

Numbers can be categories. Zip codes, jersey numbers and phone numbers are labels, so their average means nothing. The test is whether arithmetic on the values makes sense.

Counts are numerical even when they look like groups. A chart with 6 slices has one more than a chart with 5, so the average makes sense: in our download log the mean was 5.6 slices. Age is numerical too, until you group it into bands such as 18-24 and 25-34, which turns it into ordinal categories.

Categorical (qualitative)Numerical (quantitative)
What it recordsA group or labelAn amount, measured or counted
ExamplesFavorite sport, file format, zip codeHeight, test score, number of slices
Summarize withCounts, percents, the modeMean, median, range, standard deviation
ChartsPie chart, bar chart, stacked bar chartHistogram, box plot, line graph, scatter plot

Examples of categorical data

Where it comes upVariableGroupsType
Class surveyFavorite fruitApple, banana, grape, orangeNominal
Class surveyHow do you get to school?Walk, bike, bus, carNominal
HealthBlood typeA, B, AB, ONominal
HealthSmokerYes, noBinary
Customer surveySatisfactionVery unhappy to very happy, 5 stepsOrdinal
ShopProduct categoryClothing, shoes, accessoriesNominal
ShopT-shirt sizeXS, S, M, L, XLOrdinal
ElectionParty voted forOne group per partyNominal
SchoolLetter gradeA, B, C, D, FOrdinal
WebsiteDevicePhone, desktop, tabletNominal

Each row can be counted and charted the same way: one count per group. The nominal ones with a handful of groups make the clearest pie charts.

How to tell if data is categorical

  • Is each answer a name or a label, or an amount? "Bus" is a label; "12 minutes" is an amount.
  • Would an average mean anything? Trips of 12 and 20 minutes average out to 16 minutes. Bus and car have no average.
  • Could you list every possible answer in advance? Categorical variables usually have a short, fixed set of groups; measured values can take any number in a range.

If the answers are labels, an average is meaningless and the list of options is fixed, the data is categorical. If the labels also have a natural order, it is ordinal.

Categorical data in real data

Every chart downloaded from this site is logged with two categorical fields: its chart type and its file format. Here is how our download log (20,978 charts, January 29 to November 25, 2026) splits on each.

VariableGroupsMost common group (mode)Share
Chart typePie, Doughnut, Bar, LinePie (16,558)78.9%
File formatPNG, PDF, JPEG, SVGPNG (10,783)51.4%

Source: this site's anonymous download log. Both are nominal: no format is above or below another.

There is no mean chart type. The summary is the count in each group, the share of the total and the mode, which is all a pie chart needs.

How to summarize categorical data

  • A frequency table: each group and how many items fall in it.
  • Relative frequencies or percents: each count divided by the total, so groups of different sizes can be compared.
  • The mode: the group with the highest count. It is the only average that works for nominal data; ordinal data also has a median.
  • A two-way table (also called a contingency table or crosstab) when you have two categorical variables, such as grade level by favorite subject. A chi-square test checks whether the two are related.

Which chart fits categorical data

  • Pie chart: the groups are parts of one whole and there are only a few of them. The median chart in our log had 5 slices, and 78.6% had six or fewer.
  • Bar chart: many groups, ordinal groups that should stay in order, or several groups compared side by side.
  • Stacked or 100% stacked bar chart: the same categories compared across two or more groups, such as each class's favorite pet.
  • Not a histogram: its bars stand for number ranges that touch. Not a line graph: a line implies the groups follow each other in order.

Collecting categorical data so it adds up

Most categorical data comes from a question with a fixed list of answers: a survey, a form, a sign-up field. How that list is written decides whether the counts can later form a clean whole.

  • Make the groups mutually exclusive, so every answer fits only one. "Bus" and "Public transport" overlap; pick one wording.
  • Make them exhaustive, so every answer fits somewhere. Add "Other" (with a box to write it in) and, for personal questions, "Prefer not to say".
  • Decide up front whether people can pick one answer or several. Single-choice answers add up to the number of people and can go in a pie chart. Multiple-choice answers can't, because one person may be counted in three groups.
  • Keep the labels identical every time. A dropdown or a set of buttons avoids the spelling variants that free-text answers produce.
  • For ordinal scales, list the options in order and keep the same number of steps on each side of the middle.

Data collected this way goes straight into a frequency table: one row per option, one count per row, and a total that equals the number of people who answered.

Turning categories into numbers for analysis

Regression and machine learning models need numbers, so categorical data is recoded before it goes in. The usual way is dummy coding, also called one-hot encoding: one new column per group, holding 1 if the row is in that group and 0 if not.

Petis_dogis_catis_fish
Dog100
Cat010
Fish001
Dog100

One column per group. In a regression with an intercept, one group is left out as the baseline so the columns are not redundant.

Ordinal data is sometimes coded as 1, 2, 3 in order instead, which keeps the order but assumes the steps between groups are equal. That is a choice to state, not a fact about the data.

Categorical data in spreadsheets and code

  • Excel and Google Sheets: =COUNTIF(range, "Dog") counts one group; a pivot table with the column under Rows and Values set to Count builds the whole frequency table.
  • Python pandas: a column can be stored with the category dtype (df["pet"].astype("category")), and df["pet"].value_counts() gives the frequency table.
  • R: categorical variables are stored as factors (factor(x)), and table(x) counts each level.

Common mistakes

  • Averaging codes. If 1 means dog and 2 means cat, a mean of 1.4 says nothing about pets.
  • Splitting one group by spelling: "USA", "U.S." and "United States" counted as three countries. Clean the labels before counting.
  • A pie chart for a pick-all-that-apply question. People appear in several groups, so the shares add up to more than 100%.
  • Too many small groups. Fold the smallest into an Other group, or use a bar chart.

Related terms

  • Nominal data: Nominal data is categorical data with no natural order, such as favorite fruit or blood type.
  • Qualitative data: Qualitative data describes qualities or labels, such as color, brand or opinion, rather than measured amounts.
  • Quantitative data: Quantitative data is measured or counted with numbers, such as dollars, minutes or number of votes.
  • Frequency table: A frequency table lists each category and how many times it occurs, often with a running total.
  • Category: A category is one group in your data, and on a pie chart each category is one slice.

Questions

Frequently asked questions

Is categorical data the same as qualitative data?

In most statistics courses, yes. Both mean data recorded as groups or labels rather than measured amounts. Numerical data is also called quantitative data.

Is age categorical or numerical?

Age in years is numerical. Grouped into bands such as under 18, 18-34 and 35 and over, it becomes ordinal categorical data.

Is categorical data discrete?

Yes, in the sense that each item falls in one of a set number of separate groups. But discrete usually describes counts (0, 1, 2 siblings), which are numerical. Categorical data has groups, not values.

Can you find the mean of ordinal data?

Strictly, no: the gaps between groups such as agree and strongly agree aren't known to be equal. Use the median or the mode. Many surveys still report a mean of 1-to-5 scores; read it as a rough summary.

What is the best graph for categorical data?

A bar chart works for almost any categorical data. A pie chart works when the groups make up one whole, every item is in exactly one group, and there are only a few groups.

Sources (read November 25, 2026)

  1. Categorical variable, Wikipedia: nominal, ordinal and binary variables.
  2. Level of measurement, Wikipedia: which averages fit nominal and ordinal data.
  3. Categorical data, pandas user guide: the category dtype.
  4. Our pie chart statistics: chart types and file formats, January 29 to November 25, 2026.