の列に関して多くの質問と回答が寄せられていることは承知していますがNumPy、まだ行き詰っています。残念ながら、np.appendモジュールがないと言われているため、うまくいきません。
bostonメインとは別に保存された中央値を持つデータセットを使用していますboston.data(形状は(506、13)として(形状は(506、1)です)。機能(別名列)boston.targetになるようにしたいboston.targetが追加され、boston.data形状が (506, 14) になり、boston.data[13] がboston.targetデータになります。
私が見た他の提案に基づいた私の試みは次のとおりです。
np.append(boston.data, boston.target, axis=0)
print boston.data.shape
ただし、これによりエラーが発生します。
ValueError: all the input arrays must have same number of dimensions
実行しても何も返されないか、少なくとも私が知る限りでnp.append(boston.data, boston.target)は同じを返します。boston.data
私は何を間違っていますか?
編集:
誰かがipython開いている場合、コード全体は以下のとおりです。
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from sklearn.datasets import load_boston
boston = load_boston()
print boston.data.shape
print boston.target.shape
copyarr = np.append(boston.data, boston.target, axis=1) #changed still runs error
print copyarr.shape
at --> copyarr = np.append(boston.data, boston.target, axis=1)
ValueError: all the input arrays must have the same number of dimensions