Working with Python/Pandas
I have a csv file pretty simple except for one column: the source is an array.
An example of my table:
Column A |Column B |Column C |Column D |
__________________________|__________|__________|__________|
[Water, Food, Groceries] | 0 |true |9 |
[Water, Desert, Sand] | 1 |false |1 |
[Earth, Groceries] | 2 |null |12 |
[Air, Food, Car] | 3 |true |8 |
[Cristal, Love, Groceries]| 4 |false |0 |
What I want to accomplish:
Column B |Column C |Column D |column_a_water |column_a_food | column_a_groceries |
__________|__________|__________|_______________|_______________|____________________|
0 |true |9 | 1 | 1 | 1 |
1 |false |1 | 1 | 0 | 0 |
2 |null |12 | 0 | 0 | 1 |
3 |true |8 | 0 | 1 | 0 |
4 |false |0 | 0 | 0 | 1 |
With pandas get_dummies I can make it work with Column C, but not with Column A. Using the same technique it does not work.
What can I do to deal with this situation?