I have a pandas.core.series.Series that looks like the below. When using type(), I see that each row is a str. I'd like to convert this series of strings into a series of arrays. The main goal is to then be able to replace these values depending on different conditions.
Example dataset: (but my real dataset has more columns and many more rows)
0 ['5 apples', '2 pears']
1 ['3 apples', '3 pears', '1 pumpkin']
2 ['4 blueberries']
3 ['5 kiwis']
4 ['1 pumpkin']
... ...
Then, for example, if an array has the value "1 pumpkin", I'd like to replace it with "XXXX". This pandas create new column based on values from other columns / apply a function of multiple columns, row-wise was helpful for converting singular values, but I haven't been able to replace values in a series/list/array.
Desired output:
0 ['5 apples', '2 pears']
1 ['3 apples', '3 pears', 'XXX']
2 ['4 blueberries']
3 ['5 kiwis']
4 ['XXX']
... ...