I have a BQ table like this:
ID index
A [1, 3, 4]
B [2]
C [0, 3]
D [2, 3]
I hope to get a new table with a single one-hot encoded index column with a fixed length:
ID index
A [0, 1, 0, 1, 1]
B [0, 0, 1, 0, 0]
C [1, 0, 0, 1, 0]
D [0, 0, 1, 1, 0]
There is a similar problem here: Transform table to one-hot encoding for many rows, but that converted into multiple columns instead of a single column.