Traceback states this is the problem:
X=np.array([dfTrain],dtype='object')
There are mixed types in these fields (123, .45, ABC).
Below is the code I have:
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
import numpy as np
from sklearn import preprocessing
data_dir='C:/Users/Owner/Desktop/Data/XYZ/'
train = pd.read_csv(data_dir+'ABC_Train.csv')
test = pd.read_csv(data_dir+'ABC_Test.csv')
# Get labels
labels = train.Dependent.values
# clean up junk - missing
dfTrain = train
dfTrain.fillna("unk",inplace=True)
dfTest = test
dfTest.fillna("unk",inplace=True)
X=np.array([dfTrain],dtype='object')
y=np.array(labels)
Xt=np.array(dfTest,dytpe='object')
Any help would be appreciated.

New Topic/Question
Reply


MultiQuote

|