I have been following the answer from here: creating columns from values and placing other columns as those values
The code worked before, however, I made the mistake