Julia DataFrames - How to do one-hot encoding?
问题 I'm using Julia's DataFrames.jl package. In it, I have a dataframe with a columns containing a list of strings (e.g. ["Type A", "Type B", "Type D"]). How does one then performs a one-hot encoding? I wasn't able to find a pre-built function in the DataFrames.jl package. Here is an example of what I want to do: Original Dataframe col1 | col2 | 102 |[a] | 103 |[a,b] | 102 |[c,b] | After One-hot encoding col1 | a | b | c | 102 | 1 | 0 | 0 | 103 | 1 | 1 | 0 | 102 | 0 | 1 | 1 | 回答1: It is easy