This fails for me with a ValueError at lm.fit(X_train, y_train)
lm.fit(X_train, y_train)
Ignoring and continuing on to CatBoost also fails, so I suspect there's something wrong with the X_train stuff? :(
Hi @dogers Maybe something similar to ValueError: could not convert string to float: 'Diesel'?
ValueError: could not convert string to float: 'Diesel'
Numeric values or dummies for Fuel are missing. You can group them like this:
cars['fuel'] = cars['fuel'].replace('Diesel', 0) cars['fuel'] = cars['fuel'].replace('Gasoline', 1) cars['fuel'] = cars['fuel'].replace( ['Electric/Gasoline', 'Electric/Diesel', 'Electric'], 2) cars['fuel'] = cars['fuel'].replace( ['CNG', 'LPG', 'Others', '-/- (Fuel)', 'Ethanol', 'Hydrogen'], 3)
or generate dummies
cars['fuel'] = cars['fuel'].replace('Others', 'OthersFuel') fuelDummies = pd.get_dummies(cars.fuel) cars = cars.join(fuelDummies) cars = cars.drop('fuel', 1)
Sorry for the inconvenience
That's it! Used the dummies block and it's working again, thanks :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This fails for me with a ValueError at
lm.fit(X_train, y_train)
Ignoring and continuing on to CatBoost also fails, so I suspect there's something wrong with the X_train stuff? :(
Hi @dogers
Maybe something similar to
ValueError: could not convert string to float: 'Diesel'
?Numeric values or dummies for Fuel are missing. You can group them like this:
or generate dummies
Sorry for the inconvenience
That's it! Used the dummies block and it's working again, thanks :)