I'm not sure how to get rid of this error. Below is my example datasets. Is there another step that I'm missing?
Code below:
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
models = RandomForestClassifier(n_estimators=100)
np.random.seed(42)
X = re_arrange.drop('Gender',axis=1)
y = re_arrange['Gender']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
models.fit(X_train,y_train)
models.score(X_test, y_test)

RandomForestClassifierrequires features to be numerical (floatorint).Branchis string and cannot be converted tofloat. You should look at either categorical or one-hot-encoder.