in the example of the adult datasetthe categorical variables were encoded as strings on the one handthat opens up the possibility of spelling errorsbut on the other handit clearly marks variable as categorical oftenwhether for ease of storage or because of the way the data is collectedcategorical variables are encoded as integers for exampleimagine the census data in the adult dataset was collected using questionnaireand the answers for workclass were recorded as (first box ticked) (second box ticked) (third box ticked)and so on now the column will contain numbers from to instead of strings like "private"and it won' be immediately obvious to someone looking at the table representing the dataset whether they should treat this variable as continuous or categorical knowing that the numbers indicate employment statushoweverit is clear that these are very distinct states and should not be modeled by single continuous variable categorical features are often encoded using integers that they are numbers doesn' mean that they should necessarily be treated as continuous features it is not always clear whether an integer feature should be treated as continuous or discrete (and one-hotencodedif there is no ordering between the semantics that are encoded (like in the workclass example)the feature must be treated as discrete for other caseslike five-star ratingsthe better encoding depends on the particular task and data and which machine learning algorithm is used the get_dummies function in pandas treats all numbers as continuous and will not create dummy variables for them to get around thisyou can either use scikitlearn' onehotencoderfor which you can specify which variables are continuous and which are discreteor convert numeric columns in the dataframe to strings to illustratelet' create dataframe object with two columnsone containing strings and one containing integersin[ ]create dataframe with an integer feature and categorical string feature demo_df pd dataframe({'integer feature'[ ]'categorical feature'['socks''fox''socks''box']}display(demo_dftable - shows the result representing data and engineering features