dataset = pd.read_csv('train_data.csv')
X = dataset.iloc[:, 1:-1].values
y = dataset.iloc[:, -1].values
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder
ct = ColumnTransformer(transformers=[('encoder', OneHotEncoder(),[0,1,2,3,4,5,6,7,8,9,10,11,12])],remainder='passthrough')
X = np.array(ct.fit_transform(X))
from sklearn.ensemble import RandomForestRegressor
regressor = RandomForestRegressor(n_estimators = 10, random_state = 0)
regressor.fit(X, y) #Error is thrown here
TypeError Traceback (most recent call last) TypeError: float() argument must be a string or a number, not 'csr_matrix'
The above exception was the direct cause of the following exception: ValueError Traceback (most recent call last) ValueError: setting an array element with a sequence.