I have a dataframe that contains values like:
|column a|
---------
|3.5M+ |
|100,000 |
|214,123 |
|1.25M+ |
I want to convert values like 3.5M+ to 3,500,000
I've tried:
regex1 = r'.+M+'
for i in df.a:
b = re.match(regex1, i)
if b is not None:
i = int(np.double(b.string.removesuffix('M+'))*1000000)
else:
i = i.replace(',','')
if I add print statements through out, it looks like it's iterating correctly. Unforunately, the changes are not saved to the dataframe.