convert dataframe to float code example
Example 1: convert column to numeric pandas
df = df.apply(pd.to_numeric)
df[["a", "b"]] = df[["a", "b"]].apply(pd.to_numeric)
Example 2: convert price to float pandas
df['DataFrame Column'] = df['DataFrame Column'].astype(float)
Example 3: pandas dataframe convert string to float
df_raw['PricePerSeat_Outdoor'] = pd.to_numeric(df_raw['PricePerSeat_Outdoor'], errors='coerce')
Example 4: convert price to float pandas
df[df.columns[1:]] = df[df.columns[1:]].replace('[\$,]', '', regex=True).astype(float)