《python机器学习及实践》一书,第86页
x1 = np.array([1, 2, 3, 1, 5, 6, 5, 5, 5, 6, 7, 8, 9])
x2 = np.array([1, 3, 2, 2, 6, 7, 6, 7, 1, 2, 1, 1, 3])
X = np.array(zip(x1, x2)).reshape(len(x1), 2)
运行报错:
ValueError: cannot reshape array of size 1 into shape (13,2)
修改如下:
X = np.array(list(zip(x1,x2))).reshape(len(x1), 2)