teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

詳細情報の追記

2018/09/27 14:26

投稿

YZYZ
YZYZ

スコア20

title CHANGED
File without changes
body CHANGED
@@ -68,4 +68,15 @@
68
68
 
69
69
  ### 補足情報(FW/ツールのバージョンなど)
70
70
 
71
- Pythonもライブラリも最新のはずです。
71
+ Pythonもライブラリも最新のはずです。
72
+ 訓練データのデータフレームは
73
+ ```
74
+ Id MSSubClass MSZoning LotFrontage LotArea Street Alley LotShape LandContour Utilities ... PoolArea PoolQC Fence MiscFeature MiscVal MoSold YrSold SaleType SaleCondition SalePrice
75
+ 0 1 60 RL 65.0 8450 Pave NaN Reg Lvl AllPub ... 0 NaN NaN NaN 0 2 2008 WD Normal 208500
76
+ 1 2 20 RL 80.0 9600 Pave NaN Reg Lvl AllPub ... 0 NaN NaN NaN 0 5 2007 WD Normal 181500
77
+ 2 3 60 RL 68.0 11250 Pave NaN IR1 Lvl AllPub ... 0 NaN NaN NaN 0 9 2008 WD Normal 223500
78
+ 3 4 70 RL 60.0 9550 Pave NaN IR1 Lvl AllPub ... 0 NaN NaN NaN 0 2 2006 WD Abnorml 140000
79
+ 4 5 60 RL 84.0 14260 Pave NaN IR1 Lvl AllPub ... 0 NaN NaN NaN 0 12 2008 WD Normal 250000
80
+ 5 rows × 81 columns
81
+ ```
82
+ となっていて、訓練データ、テストデータ共に、モデルに使用する説明変数の欠損値は0個の状態になってます。

1

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

2018/09/27 14:25

投稿

YZYZ
YZYZ

スコア20

title CHANGED
File without changes
body CHANGED
@@ -5,6 +5,33 @@
5
5
  ### 発生している問題・エラーメッセージ
6
6
 
7
7
  ```
8
+ ---------------------------------------------------------------------------
9
+ IndexingError Traceback (most recent call last)
10
+ <ipython-input-62-686d210ba347> in <module>()
11
+ 1 # 作ったモデルをテスト用データに適用してみる
12
+ ----> 2 Pred = forest.predict(test.loc[:, ["OverallQual", "YearBuilt", "YearRemodAdd", "1stFlrSF", "GrLivArea", "FullBath", "GarageCars"]].values.reshape(-1,))
13
+
14
+ ~\Anaconda3\lib\site-packages\pandas\core\indexing.py in __getitem__(self, key)
15
+ 1470 except (KeyError, IndexError):
16
+ 1471 pass
17
+ -> 1472 return self._getitem_tuple(key)
18
+ 1473 else:
19
+ 1474 # we by definition only have the 0th axis
20
+
21
+ ~\Anaconda3\lib\site-packages\pandas\core\indexing.py in _getitem_tuple(self, tup)
22
+ 873
23
+ 874 # no multi-index, so validate all of the indexers
24
+ --> 875 self._has_valid_tuple(tup)
25
+ 876
26
+ 877 # ugly hack for GH #836
27
+
28
+ ~\Anaconda3\lib\site-packages\pandas\core\indexing.py in _has_valid_tuple(self, key)
29
+ 218 for i, k in enumerate(key):
30
+ 219 if i >= self.obj.ndim:
31
+ --> 220 raise IndexingError('Too many indexers')
32
+ 221 try:
33
+ 222 self._validate_key(k, i)
34
+
8
35
  IndexingError: Too many indexers
9
36
 
10
37
  ```