Kizspy | Question: 10
(Choose 1 answer)
You have a DataFrame df:
df pd.DataFrame({
})
'Price': ['$100', '200 USD', '300.50', '$ 400.75']
Which code snippet normalizes all prices by removing the currency symbol and converting them to a float?
A. df['Price'] df['Price'].str.extract(r'(\d+\.\d+|\d+)').astype(float)
B. df['Price'] =df['Price'].str.replace(r'[S,]", ", regex=True).astype(float)
C. df['Price']=df['Price'].str.replace(r'\D", ").astype(float)
D. df['Price'] =df['Price'].str.replace(r'\D", ", regex=True).astype(float)