I have a pyspark data frame like so-
This is a simplified version of the problem that I am trying to solve. In fact the "label" column may have as many as 20 items (which will be strings) in one row. Right now we just have 3 options to choose from, i.e. 0, 1, and 2.
For the problem shown in the image, what I want is three more columns - label_0, label_1, and label_2. For example, the table will look like this after the transformation.
This might look similar to doing one-hot encoding. I am finding a hard time doing this in pyspark.

