Https://www.codecademy.com/courses/machine-learning/projects/ranodm-forest-income

Predicting Income with Random Forests

I have Error when I split:
ValueError: Found input variables with inconsistent numbers of samples: [1, 32561]

income_data=pd.read_csv(“income.csv”,header=0,delimiter=", ")
labels=income_data[[“income”]]
data=[[“age”,“capital-gain”,“capital-loss”,“hours-per-week”,“sex”]]
print(income_data.iloc[1])

age 50
workclass Self-emp-not-inc
fnlwgt 83311
education Bachelors
education-num 13
marital-status Married-civ-spouse
occupation Exec-managerial
relationship Husband
race White
sex 0
capital-gain 0
capital-loss 0
hours-per-week 13
native-country United-States
income <=50K
Name: 1, dtype: object

train_data, test_data, train_labels,test_labels = train_test_split(data,labels,random_state=1)

ValueError: Found input variables with inconsistent numbers of samples: [1, 32561]

I have error all the time i do split in projects. If any help<, I would appreciate it.

data = income_data[[“age”,“capital-gain”,“capital-loss”,“hours-per-week”,“sex”]]

Thanks, I already give up, go back to finish project.