【发布时间】:2019-05-03 03:39:16
【问题描述】:
我有这个数据
我正在尝试应用这个:
one_hot = pd.get_dummies(df)
但我收到此错误:
这是我之前的代码:
# Import modules
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import tree
df = pd.read_csv('AllMSAData.csv')
df.head()
corr_matrix = df.corr()
corr_matrix
df.describe()
# Get featurs and targets
labels = np.array(df['CurAV'])
# Remove the labels from the features
# axis 1 refers to the columns
df = df.drop('CurAV', axis = 1)
# Saving feature names for later use
feature_list = list(df.columns)
# Convert to numpy array
df = np.array(df)
【问题讨论】:
-
你要假人做什么?例如,您需要向它传递一个系列。
-
我需要将分类数据更改为数值来执行随机森林
标签: python pandas numpy machine-learning