Categorical data
Categorical data consists of values representing membership in discrete categories rather than measured numerical magnitudes.
Statistics Slam Dunk
A categorical variable records observations as membership in one of a finite set of qualitative categories.
- How it is used
- Organizes NBA observations into groups for visualization, summaries, segmentation, and statistical analysis.
- How deep it goes
- Defines fixed-value variables, demonstrates conversion and recoding, and applies factors in grouped analyses without detailing factor internals.
- Examples
- Uses draft year, teams, player positions, birth region, draft segments, play events, free throws, and standardized scoring categories.
- What you can do after
- Apply it via base R functions to convert, inspect, recode, group, and visualize fixed-set variables as factors.
The Well-Grounded Data Analyst
Categorical data consists of values representing membership in discrete, named groups or categories.
- How it is used
- Guides analysis of survey, operational, and hierarchy fields whose values represent discrete groups rather than measurements.
- How deep it goes
- Defines nominal and ordinal categories, then develops inspection, encoding, cross-tabulation, binning, visualization, and statistical-test choices without deriving the tests.
- Examples
- Uses heart-disease slope codes, cinema COVID periods and genres, and a developer survey about AI tools.
- What you can do after
- Apply it by inspecting categories, preserving ordinal order, encoding model inputs, and comparing groups with appropriate tables, plots, and tests.
Read how The Well-Grounded Data Analyst explains categorical data →
Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI
An input variable whose values represent membership in discrete categories rather than continuous quantities.
- How it is used
- Classifies tabular columns so they receive processing appropriate to discrete labels rather than continuous measurements.
- How deep it goes
- Explains identification through samples and distinct-value counts, then introduces one-hot encoding and embeddings without implementation details.
- Examples
- Uses currency attributes, Auto MPG origin and cylinders, and Kuala Lumpur property location, type, furnishing, and numeric-looking fields.
- What you can do after
- Evaluate/understand whether a column is categorical and select one-hot encoding or embeddings as possible transformations.
Grokking Machine Learning
Data whose values belong to a finite set of named categories or states.
- How it is used
- Distinguishes supervised-learning labels that predict categories from numerical labels and identifies categorical input features for preprocessing.
- How deep it goes
- Defines finite categories and names one-hot encoding and binning as ways to convert between categorical and numerical representations.
- Examples
- Uses animal types, spam or ham labels, gender, and passenger embarkation ports as examples.
- What you can do after
- Apply one-hot encoding to categorical features or bin numerical features into categories before model training.
Read how Grokking Machine Learning explains categorical data →
Data Without Labels
A categorical variable records membership in one of a set of qualitative categories rather than a numeric magnitude.
- How it is used
- Identifies qualitative inputs that may need conversion for clustering and categorical outcomes predicted by classification.
- How deep it goes
- Defines binary, nominal, and ordinal types, then demonstrates numeric conversion and warns about sparse columns and low-value fields.
- Examples
- Uses city indicator columns, low-variation city and zip-code fields, and edible-or-poisonous mushroom classes.
- What you can do after
- Apply it via pandas get_dummies() or scikit-learn LabelEncoder, while checking whether category counts and variation make a field useful.
Outlier Detection in Python
Categorical data consists of values drawn from discrete categories rather than measured on a continuous numerical scale.
- How it is used
- Uses category frequencies, combinations, and categorical clustering to identify potentially unusual tabular rows.
- How deep it goes
- Works through count-based detection, combination counts, detector preparation, and a KModes scoring example, while cautioning against automatic interpretations of rarity.
- Examples
- Uses staff expenses, categorical combinations in eucalyptus data, and synthetic KModes rows with an inserted outlier.
- What you can do after
- Apply it via category counts or KModes to flag unusual values, combinations, or cluster-center mismatches for review.
Read how Outlier Detection in Python explains categorical data →
Ensemble Methods for Machine Learning
A categorical variable is an input variable whose values belong to a finite set of discrete categories.
- How it is used
- Uses categorical inputs in machine-learning models after choosing encodings that reflect their underlying structure.
- How deep it goes
- Defines nominal and ordinal categories, motivates encoding, and contrasts preprocessing with direct categorical boosting.
- Examples
- Uses T-shirt color and size, demographic income prediction, ZIP codes, and weather categories as concrete examples.
- What you can do after
- Apply it by distinguishing category types and selecting preprocessing or categorical-aware ensemble tooling.
Read how Ensemble Methods for Machine Learning explains categorical data →
Effective Data Analysis
A categorical variable is a variable whose values represent membership in distinct categories rather than measured numerical amounts.
- How it is used
- Represents group membership for predictive modeling, feature derivation, and comparisons between observed and expected frequencies.
- How deep it goes
- Explains dummy coding, omitted reference categories, binary regrouping, visual checks, and chi-square testing, but not model internals.
- Examples
- Uses day-of-week categories, rat-sighting boxplots, dummy-coded predictors, and a weekday indicator in a weather dataset.
- What you can do after
- Apply it via dummy coding, binary regrouping, visualization, correlation checks, and chi-square comparisons.
Read how Effective Data Analysis explains categorical data →
Deep Learning with PyTorch, Second Edition
A variable type whose values are treated as discrete labels rather than ordered magnitudes.
- How it is used
- Distinguishes label-like values from continuous and ordinal values, then guides representations for learning tasks.
- How deep it goes
- Defines categorical values by contrast, then works through one-hot outputs and learned embedding alternatives.
- Examples
- Uses airplane-versus-bird labels, CIFAR-10 classes, text vocabularies, and recommender-system items.
- What you can do after
- Apply it via one-hot encoding or embeddings when preparing categorical inputs and classifier targets.
Read how Deep Learning with PyTorch, Second Edition explains categorical data →
Delivering Machine Learning Projects: From design to deployment
Categorical data is data whose values belong to a finite set of discrete categories rather than representing continuous quantities.
- How it is used
- Supports data surveys by revealing category coverage, distributions, unexpected values, and questions for exploratory-data-analysis follow-up.
- How deep it goes
- Defines categorical fields and gives SQL-based inspection steps, but stops short of investigating category effects in exploratory analysis.
- Examples
- Uses smart-building sensor types, distinct-value counts, category listings, and the UNKNOWN value as concrete survey artifacts.
- What you can do after
- Evaluate category distributions and produce prioritized exploratory-data-analysis questions for deeper investigation.
Read how Delivering Machine Learning Projects: From design to deployment explains categorical data →
Grokking AI Algorithms, Second Edition
Categorical data consists of values representing membership in discrete named or ordered categories.
- How it is used
- Supports classification and prepares named or ordered values for numerical modeling.
- How deep it goes
- Defines categorical features, contrasts them with continuous values, and explains encoding and missing-value choices.
- Examples
- Uses diamond Cut, Color, Clarity, and Origin plus vehicle, animal, and device classes as concrete examples.
- What you can do after
- Apply one-hot or label encoding appropriately and choose reasonable treatments for missing categorical values.
Read how Grokking AI Algorithms, Second Edition explains categorical data →
Everyday Data Visualization
Data whose values represent categories for which the ordering of values is not inherently meaningful.
- How it is used
- Distinguishes categorical from sequential values to guide visualization choices.
- How deep it goes
- Defines categorical values, contrasts their ordering with sequential data, and gives visual encoding guidance without implementation internals.
- Examples
- Uses sales regions, bike-rental thresholds, fruit data, funnel steps, pain scales, generations, and survey responses as examples.
- What you can do after
- Evaluate categorical encodings and apply color with an additional visual cue when designing data displays.
Read how Everyday Data Visualization explains categorical data →
Math and Architectures of Deep Learning
A variable that takes one value from a finite set of categories rather than a continuum of real values.
- How it is used
- Distinguishes finite-valued targets from continuous quantities and frames categorical outputs as classification problems.
- How deep it goes
- Defines categories, binary variables, classifier mappings, and decision-boundary geometry, but does not develop implementation code.
- Examples
- Uses stock-selling advice, face detection, image vectors, cat-threat classification, and sampled class regions.
- What you can do after
- Evaluate/understand whether a target is categorical and interpret its classifier output as a class or region in input space.
Read how Math and Architectures of Deep Learning explains categorical data →
Grokking Machine Learning, Second Edition
Categorical data consists of values selected from a finite set of categories or states.
- How it is used
- Classifies labeled examples and represents non-numerical feature values in supervised learning models.
- How deep it goes
- Defines finite categories, contrasts them with numerical data, and shows encoding and decision-tree handling without deeper representation theory.
- Examples
- Uses animal labels, spam detection, user platforms, dog/cat/bird features, and housing locations as concrete examples.
- What you can do after
- Apply it via classification, decision-tree splits, or one-hot encoding before training a linear regression model.
Read how Grokking Machine Learning, Second Edition explains categorical data →
Deep Learning with Python, Third Edition
Data whose values belong to discrete categories rather than a continuous numeric scale.
- How it is used
- Uses discrete feature values to choose representations, model architectures, and classification output configurations.
- How deep it goes
- Explains category vectors, order-sensitive alternatives, dense-network use, output activations, target encodings, and losses.
- Examples
- Uses tokens, bag-of-words text, the Boston Housing Price dataset, and Keras classification configurations as concrete examples.
- What you can do after
- Apply categorical representations and select activations, target encodings, losses, and network types for classification tasks.
Read how Deep Learning with Python, Third Edition explains categorical data →
Statistics Every Programmer Needs
A categorical variable is a variable whose values represent membership in distinct qualitative classes or categories.
- How it is used
- Uses qualitative classes for descriptive summaries, comparisons, and conditional-probability calculations.
- How deep it goes
- Defines classes and counts, then works through contingency tables and conditional probabilities without extending into advanced modeling.
- Examples
- Uses symptoms and medical-test results, represented as labeled rows, columns, and frequency-count cells.
- What you can do after
- Apply it via pandas by constructing contingency tables and calculating category-specific proportions.
Read how Statistics Every Programmer Needs explains categorical data →
Causal AI
A categorical variable is a variable whose values are labels from a finite set of categories rather than numerical measurements.
- How it is used
- Supports fitting causal graphical models when variables take discrete labeled values.
- How deep it goes
- Connects categorical variables to learned conditional probability tables and explains lookup probabilities, but does not develop encoding methods.
- Examples
- Uses transportation survey responses and car, train, or other choices conditioned on occupation and residence.
- What you can do after
- Apply it via pgmpy by fitting a Bayesian network and inspecting its learned conditional probability tables.
Also covered in
- Pandas Workout: 200 exercises to make you a stronger data analyst
- Fight Fraud with Machine LearningIn early access (MEAP)
- Deep Learning with R, Third Edition
- Grokking BayesIn early access (MEAP)
- AI Recommender SystemsIn early access (MEAP)
- Learn Generative AI with PyTorch
- Machine Learning Platform Engineering
- Software Engineering for Data ScientistsIn early access (MEAP)
What to know first
- linear regressionLinear regression is a statistical method that models a numeric response as a linear function of one or more predictor variables with fitted parameters.
- data frameA data frame is a two-dimensional tabular data structure organized into labeled rows and columns, often with columns that can contain different types of values.
- continuous dataContinuous data consists of numerical values that can vary across a range with arbitrarily fine precision.
- CSVCSV is a text format for tabular data in which records contain fields separated by commas, with conventions for quoting fields that contain special characters.
Related concepts
- classifierproduced by · A classifier is a predictive model that assigns an input to one or more discrete classes or categories.
- binary variablecontrasts with · A binary variable is a variable that can take exactly two possible values or categories.
- datakind of · Data is recorded or represented information, observations, measurements, or values that can be stored, processed, communicated, or interpreted.
- one-hot encodingused by · One-hot encoding represents a categorical value as a binary vector with one active component identifying its category and all other components inactive.
- chi-square testused by · A chi-square test is a statistical hypothesis test that uses a chi-square-distributed statistic to evaluate hypotheses about categorical data, goodness of fit, or variance.
Questions about categorical data
What is categorical data?
Categorical data consists of values representing membership in discrete categories rather than measured numerical magnitudes.
Which Manning books explain categorical data?
Statistics Slam Dunk, The Well-Grounded Data Analyst, Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI, Grokking Machine Learning, Data Without Labels, Outlier Detection in Python, Ensemble Methods for Machine Learning, Effective Data Analysis and 9 more.
What should I know before learning categorical data?
Manning books that teach categorical data usually introduce linear regression, data frame, continuous data and CSV first.
What is the difference between categorical data and binary variable?
Categorical data consists of values representing membership in discrete categories rather than measured numerical magnitudes. A binary variable is a variable that can take exactly two possible values or categories.
What is categorical data a kind of?
Categorical data is a kind of data. Data is recorded or represented information, observations, measurements, or values that can be stored, processed, communicated, or interpreted.
What is categorical data also called?
Categorical data is also called categorical variable or categorical feature.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
















