AI engineering glossary · NumPy pandas visualization
What is categorical dtype?
Categorical dtype (also called category): A pandas data type for a column that takes a limited set of repeated values, such as city or grade. The values are stored once as categories and the column holds small integer codes. It saves memory, speeds up grouping and can carry a meaningful order.
Categorical dtype: an example
Converting a 10-million-row column of 'Mumbai', 'Delhi' and 'Chennai' with astype('category') cuts its memory use sharply.
Related terms
- dtype
- astype
- pandas groupby
- Nullable dtype
More NumPy pandas visualization terms
- Chunked reading
- Colormap
- Colour-blind-safe palette
- Concatenate
- Copy-on-write
- crosstab
- Data-ink ratio
- DataFrame
Where you learn it
Categorical dtype is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.