I am trying to figure out how to loop trough columns to replace its values,
My dataset looks like this:
In this example, i want to replace the decimal comma of the first two columns with decimal points.
When trying to for loop like so:
for col in opel_Df[['Altitude Variation', 'Vehicle Speed Instantaneous']]:
opel_Df[col] = opel_Df[col].replace(',', '.')
Nothing happens, but this is because i have to set inplace=True
but when i do so, i get none
values:
If anyone could help me figuring this out...
CodePudding user response:
I would do:
col = ['Altitude Variation', 'Vehicle Speed Instantaneous']
opel_Df[col] = opel_Df[col].replace(',', '\.', regex=True)