Skip to content
Advertisement

How does pandas.DataFrame.replace works?

I need to remove ‘$’ symbol in ‘price’ column. I used pd.DataFrame.replace to do that.

replace result.

Why did nothing happen?

If I use str.replace it works: str.replace

Advertisement

Answer

Try this :

listings['price'].str.replace({'$':''},regex=True,inplace=True)
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement