I'm using Streamlit to build a machine learning model to predict the price of a car. After splitting the data into train and test and choosing the best model, I need to predict the price of a car based on the user input
ax1,ax2 = st.columns(2)
with ax1:
year = st.slider('Year The Car Manufatured', 1996,2020,1996)
model = st.selectbox('model',('Fiesta' ,'Focus','Kuga','EcoSport','C-MAX','Ka+','Mondeo','B-MAX','S-MAX','Grand C-MAX','Galaxy','Edge','KA','Puma','Tourneo Custom','Grand Tourneo Connect','Mustang','Tourneo Connect','Fusion','Streetka','Ranger','Transit Tourneo','Escort','Focus','Transit Tourneo'))
transmission = st.selectbox('transmission', ('Manual','Automatic','Semi-Auto'))
mileage = st.slider('How many mileage?', 0, 18000)
with ax2:
fuelType= st.selectbox('fuelType', ('Petrol','Diesel','Hybrid','Electric','Other'))
tax= st.slider('Tax Amount', 0, 600)
mpg = st.slider('MPG', 0, 250)
engineSize = st.slider('engineSize', 0, 5)
data = {'year':[year],'model':[model],'transmission':[transmission],
'fuelType':[fuelType],'mileage':[mileage],'mpg':[mpg],'engineSize':[engineSize],
'tax':[tax],}
features = pd.DataFrame(data)
cars = pd.read_csv("ford.csv")
cars.columns = cars.columns.str.strip()
cars.fillna(0, inplace=True)
cars = cars.drop(columns=['price'])
df = pd.concat([features,cars],axis=0)
df.columns = df.columns.str.strip()
df = pd.get_dummies(df, columns = ['model','transmission', 'fuelType'],drop_first=True)
df = df[:1]
df.fillna(0, inplace=True)
def RFR():
RFR= RandomForestRegressor(n_estimators=10, min_samples_leaf=0.05)
RFR= RFR.fit(x, y)
prediction = RFR().predict(df)
i'm getting the below error:
ValueError: could not convert string to float: ' Fiesta'
Any Idea what might be the problem ?