A B C D E F
0 CEKAPE 23.60% 117.374 0.53% 0.11% <2%
1 HYTFFZ 25.32% 116.250 1.88% 0.38% 5%
The df has several columns that contain percetage numbers as string type. This code only process one column at a time. df['D'] = df['D'].str.strip('%').astype(float) / 100
How to write the code while dozens of cloumns need to be processed?
A B C D E F
0 CEKAPE 0.2360 117.374 0.0053 0.0011 <2%
1 HYTFFZ 0.2532 116.250 0.0188 0.0038 0.05