I have a pandas Dataframe as
position base text
1 458372 A 19:t|12:cg|7:CG|1:tcag|1:T
2 458373 C 21:GCA|3:GCG|3:ATA|2:GCGAA|1:GTA|1:CGAG|1:g
I would like to retrieve the numbers from the text column and add them up in another column. Values in the text column contain numbers separated by any non-numerical values [^0-9]. In the first row value of the text column, the numbers are 19, 12, 7, 1, and 1, which would add to 40, which would be a value in the new column. The resulting Dataframe would look like:
position base text text_sum
1 458372 A 19:t|12:cg|7:CG|1:tcag|1:T 40
2 458373 C 21:GCA|3:GCG|3:ATA|2:GCGAA|1:GTA|1:CGAG|1:g 32
Any clues as to how to approach this?