1.Demo from sklearn import tree import pydotplus import numpy as np #李航p59表数据 #年龄,有工作,有自己房子,信贷情况,类别 #青年0 中年1 老年2 #否0 是1 #一般0 好1 非常好2 datasets = np.array([['], ['], ['], ['], ['], ['], ['], ['], ['], ['], ['], ['], ['], ['], [']]) X = datasets[:,:4] Y