質問編集履歴

2

詳細情報の追記

2018/09/27 14:26

投稿

YZYZ
YZYZ

スコア20

test CHANGED
File without changes
test CHANGED
@@ -139,3 +139,25 @@
139
139
 
140
140
 
141
141
  Pythonもライブラリも最新のはずです。
142
+
143
+ 訓練データのデータフレームは
144
+
145
+ ```
146
+
147
+ Id MSSubClass MSZoning LotFrontage LotArea Street Alley LotShape LandContour Utilities ... PoolArea PoolQC Fence MiscFeature MiscVal MoSold YrSold SaleType SaleCondition SalePrice
148
+
149
+ 0 1 60 RL 65.0 8450 Pave NaN Reg Lvl AllPub ... 0 NaN NaN NaN 0 2 2008 WD Normal 208500
150
+
151
+ 1 2 20 RL 80.0 9600 Pave NaN Reg Lvl AllPub ... 0 NaN NaN NaN 0 5 2007 WD Normal 181500
152
+
153
+ 2 3 60 RL 68.0 11250 Pave NaN IR1 Lvl AllPub ... 0 NaN NaN NaN 0 9 2008 WD Normal 223500
154
+
155
+ 3 4 70 RL 60.0 9550 Pave NaN IR1 Lvl AllPub ... 0 NaN NaN NaN 0 2 2006 WD Abnorml 140000
156
+
157
+ 4 5 60 RL 84.0 14260 Pave NaN IR1 Lvl AllPub ... 0 NaN NaN NaN 0 12 2008 WD Normal 250000
158
+
159
+ 5 rows × 81 columns
160
+
161
+ ```
162
+
163
+ となっていて、訓練データ、テストデータ共に、モデルに使用する説明変数の欠損値は0個の状態になってます。

1

エラーを省略せずに記しました。

2018/09/27 14:25

投稿

YZYZ
YZYZ

スコア20

test CHANGED
File without changes
test CHANGED
@@ -11,6 +11,60 @@
11
11
 
12
12
 
13
13
  ```
14
+
15
+ ---------------------------------------------------------------------------
16
+
17
+ IndexingError Traceback (most recent call last)
18
+
19
+ <ipython-input-62-686d210ba347> in <module>()
20
+
21
+ 1 # 作ったモデルをテスト用データに適用してみる
22
+
23
+ ----> 2 Pred = forest.predict(test.loc[:, ["OverallQual", "YearBuilt", "YearRemodAdd", "1stFlrSF", "GrLivArea", "FullBath", "GarageCars"]].values.reshape(-1,))
24
+
25
+
26
+
27
+ ~\Anaconda3\lib\site-packages\pandas\core\indexing.py in __getitem__(self, key)
28
+
29
+ 1470 except (KeyError, IndexError):
30
+
31
+ 1471 pass
32
+
33
+ -> 1472 return self._getitem_tuple(key)
34
+
35
+ 1473 else:
36
+
37
+ 1474 # we by definition only have the 0th axis
38
+
39
+
40
+
41
+ ~\Anaconda3\lib\site-packages\pandas\core\indexing.py in _getitem_tuple(self, tup)
42
+
43
+ 873
44
+
45
+ 874 # no multi-index, so validate all of the indexers
46
+
47
+ --> 875 self._has_valid_tuple(tup)
48
+
49
+ 876
50
+
51
+ 877 # ugly hack for GH #836
52
+
53
+
54
+
55
+ ~\Anaconda3\lib\site-packages\pandas\core\indexing.py in _has_valid_tuple(self, key)
56
+
57
+ 218 for i, k in enumerate(key):
58
+
59
+ 219 if i >= self.obj.ndim:
60
+
61
+ --> 220 raise IndexingError('Too many indexers')
62
+
63
+ 221 try:
64
+
65
+ 222 self._validate_key(k, i)
66
+
67
+
14
68
 
15
69
  IndexingError: Too many indexers
16
70