A categorical variable is a type of variable that can take on one of a limited, fixed number of possible values, assigning each individual or other unit of observation to a particular group or nominal category. These variables are often used in statistical analysis to represent qualitative data and are essential for classification tasks in machine learning.