Categorical Manipulation
Explore the handling of categorical data in pandas.
So far, we have dealt with numeric and date data. Another common form of data is textual data, and a subset of textual data is categorical data. Categorical data is textual data that has repetitions.
Categorical data
Categories are labels that describe data. Values are oftentimes repeated, and when they have an intrinsic order, they are referred to as ordinal values. One example is shirt sizes: small, medium, and large. Unordered values such as colors are called nominal values. We can convert numerical data to categories by binning them.
We’ll start by looking at the categorical values found in the fuel economy dataset. The make
column has categorical information:
Get hands-on with 1400+ tech skills courses.