Skip to content

Commit 7732582

Browse files
committed
Solves issue #4
1 parent c57d7f6 commit 7732582

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

python/model/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ def _validate(self, input):
166166
elif var_type == 'category':
167167
if categories is not None:
168168
var_type = CategoricalDtype(categories=categories, ordered=True)
169+
new_cat = set(df[name].unique()).difference(categories)
170+
if len(new_cat):
171+
msg = 'Unexpected categorical value in input data: {}'.format(new_cat)
172+
raise ValueError(msg)
169173
else:
170174
msg = 'Missing "categories" for "{}" in metadata'.format(name)
171175
raise ValueError(msg)

0 commit comments

Comments
 (0)