A model only understands numbers, but your data has a color column: red, green or blue. Write encode(color, all_colors): turn one color into a list of numbers the model can use.
Three cars and what they sold for. A model only reads numbers, so the colors need numbers, and a model reads a number as an amount. Watch what numbering them red 0, green 1, blue 2 does, then number them another way.
encode(color, all_colors)| color | one of all_colors, e.g. "green" | e.g. "red" |
| all_colors | every color there is, e.g. ["red", "green", "blue"] | e.g. ["red", "green", "blue"] |
| returns | a list of numbers for this color | |