from the outputwe can see that mapping scheme has been generated where each genre value is mapped to number with the help of the labelencoder object gle the transformed labels are stored in the genre_labels value let' write it back to the original dataframe and view the results in [ ]vg_df['genrelabel'genre_labels vg_df[['name''platform''year''genre''genrelabel']iloc[ : out[ ]name platform year genre genrelabel super mario bros nes platform mario kart wii wii racing wii sports resort wii sports pokemon red/pokemon blue gb role-playing tetris gb puzzle new super mario bros ds platform the genrelabel field depicts the mapped numeric labels for each of the genre labels and we can clearly see that this adheres to the mappings that we generated earlier transforming ordinal features ordinal features are similar to nominal features except that order matters and is an inherent property with which we can interpret the values of these features like nominal featureseven ordinal features might be present in text form and you need to map and transform them into their numeric representation let' now load our pokemon dataset that we used earlier and look at the various values of the generation attribute for each pokemon in [ ]poke_df pd read_csv('datasets/pokemon csv'encoding='utf- 'poke_df poke_df sample(random_state= frac= reset_index(drop=truenp unique(poke_df['generation']out[ ]array(['gen ''gen ''gen ''gen ''gen ''gen ']dtype=objectwe resample the dataset in this code just so we can get good slice of data later on that represents all the distinct values which we are looking for from this output we can see that there are total of six generations of pokemon this attribute is definitely ordinal because pokemon belonging to generation were introduced earlier in the video games and the television shows than generation and so on hence they have sense of order among them unfortunatelysince there is specific logic or set of rules involved in case of each ordinal variablethere is no generic module or function to map and transform these features into numeric representations hence we need to hand-craft this using our own logicwhich is depicted in the following code snippet in [ ]gen_ord_map {'gen ' 'gen ' 'gen ' 'gen ' 'gen ' 'gen ' poke_df['generationlabel'poke_df['generation'map(gen_ord_mappoke_df[['name''generation''generationlabel']iloc[ : out[ ]name generation generationlabel octillery gen helioptile gen dialga gen