i have tried to solve this but couldn’t solve it, like i also cahnge the datatype of column enginetype that were having ohc in their rows but changing that datatype to float didn’t work for me. please help me to solve this error.
ValueError Traceback (most recent call last)
<ipython-input-28-a48ec3de5487> in <cell line: 2>()
1 lr= LinearRegression()
----> 2 lr.fit(X_train,y_train)
3
4 rf= RandomForestRegressor()
5 rf.fit(X_train,y_train)
5 frames
/usr/local/lib/python3.10/dist-packages/pandas/core/generic.py in __array__(self, dtype)
1996 def __array__(self, dtype: npt.DTypeLike | None = None) -> np.ndarray:
1997 values = self._values
-> 1998 arr = np.asarray(values, dtype=dtype)
1999 if (
2000 astype_is_view(values.dtype, arr.dtype)
ValueError: could not convert string to float: 'ohc'
New contributor