python/pandas/ValueError: y contains previously unseen labels: ''.md
... ...
@@ -10,4 +10,6 @@ le.fit(X)
10 10
11 11
le_dict = dict(zip(le.classes_, le.transform(le.classes_)))
12 12
df[your_col] = df[your_col].apply(lambda x: le_dict.get(x, None))
13
-```
... ...
\ No newline at end of file
0
+```
1
+
2
+これに対して、`df = df.dropna()`を適用すればラベルが無いデータを捨てられる。ただし、トレーニングデータには含まれるけど、テストデータに含まれないようなラベルがあっていいのか(一般的な機械学習的に)どうかは分からない。
... ...
\ No newline at end of file