check the contents of column is using the value_counts function of pandas series (the type of single column in dataframe)to show us what the unique values are and how often they appearin[ ]print(data gender value_counts()out[ ]male female namegenderdtypeint we can see that there are exactly two values for gender in this datasetmale and femalemeaning the data is already in good format to be represented using onehot-encoding in real applicationyou should look at all columns and check their values we will skip this here for brevity' sake there is very simple way to encode the data in pandasusing the get_dummies function the get_dummies function automatically transforms all columns that have object type (like stringsor are categorical (which is special pandas concept that we haven' talked about yet)in[ ]print("original features:\ "list(data columns)"\ "data_dummies pd get_dummies(dataprint("features after get_dummies:\ "list(data_dummies columns)out[ ]original features['age''workclass''education''gender''hours-per-week''occupation''income'features after get_dummies['age''hours-per-week''workclass_ ?''workclass_ federal-gov''workclass_ local-gov''workclass_ never-worked''workclass_ private''workclass_ self-emp-inc''workclass_ self-emp-not-inc''workclass_ state-gov''workclass_ without-pay''education_ th''education_ th''education_ th''education_ st- th''education_ preschool''education_ prof-school''education_ some-college''gender_ female''gender_ male''occupation_ ?''occupation_ adm-clerical''occupation_ armed-forces''occupation_ craft-repair''occupation_ exec-managerial''occupation_ farming-fishing''occupation_ handlers-cleaners''occupation_ tech-support''occupation_ transport-moving''income_ 'categorical variables