Now I have a data frame with entries like '7M'as a string where M is Million and I want to change it to 7000000 This is a look from the data frame
I have tried to make a function to separate the numbers from the letter and changing the letter to a number and it worked
def num_repair(x):
if 'B' in x:
l = 10**9
x = x[:-1]
x = pd.to_numeric(x)
x = x * l
elif 'TR' in x:
l = 10**12
x =x[:-2]
x = pd.to_numeric(x)
x = x * l
elif 'M' in x:
l = 10**6
x = x[:-1]
x = pd.to_numeric(x)
x = x * l
return(x)
and when I tried to apply it to the data frame it didn't give me anything any help please?