Categorical data
I broadly classify data into dates, continuous values, and categorical values. In this section, we will explore quantifying and visualizing categorical data.
How to do it…
- Pick out the columns with data types that are
object
:>>> fueleco.select_dtypes(object).columns Index(['drive', 'eng_dscr', 'fuelType', 'fuelType1', 'make', 'model', 'mpgData', 'trany', 'VClass', 'guzzler', 'trans_dscr', 'tCharger', 'sCharger', 'atvType', 'fuelType2', 'rangeA', 'evMotor', 'mfrCode', 'c240Dscr', 'c240bDscr', 'createdOn', 'modifiedOn', 'startStop'], dtype='object')
- Use
.nunique
to determine the cardinality:>>> fueleco.drive.nunique() 7
...