0

I have a dataframe that looks like this

id      features
0   [Bluetooth, Rear View Camera, Power Windows, A...
1   [Rear View Camera, Power Windows, Air Conditio...
2   [Bluetooth, Stability Control, Traction Contro...

I want to explode the lists on each row and based on the list create new columns indicating its presence I want my sample output to appear as:

id     'Bluetooth' 'Rear view camera' 'Power windows' ....
0       1 1 1
1       0 1 1
2       0 0 0

I tried using .explode() and I guess I would need to use pivot or pivot table as well but am unsure how to proceed further.

eric
  • 1

0 Answers0