Very new to pandas and I'm trying to sum the elements of a list in a single column for a pandas dataframe, except I can't find a way to do so
The dataframe looks something like this:
index codes
0 [19, 19]
1 [3, 4]
2 [20, 5, 3]
3 NaN
4 [1]
5 NaN
6 [14, 2]
What I'm trying to get is:
index codes total
0 [19, 19] 38
1 [3, 4] 7
2 [20, 5, 3] 28
3 NaN 0
4 [1] 1
5 NaN 0
6 [14, 2] 16
However the values in codes were obtained by using str.findall('-(\d+)') from a different column, so they are not a list of ints
Any help would be much appreciated, thanks.