I have a column in dataframe named price that has values like 100, 200, 2300,2300+200 so on. How can i replace 2300+200 with sum of those 2 numbers i.e as 2500.
Use eval in apply:
eval
apply
df = pd.DataFrame({'col':[10,'1000+1']}) df['col'] = df['col'].apply(pd.eval) print (df) col 0 10 1 1001
1.4m articles
1.4m replys
5 comments
56.9k users