Skip to content

Commit 2f0c4eb

Browse files
committed
Solves issue #1
1 parent 79953ea commit 2f0c4eb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

python/model/base.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,12 @@ def _validate(self, input):
163163
var_type = float
164164
elif var_type == 'string':
165165
var_type = str
166-
elif (var_type == 'category') and (categories is not None):
167-
var_type = CategoricalDtype(categories=categories,
168-
ordered=True)
166+
elif var_type == 'category':
167+
if categories is not None:
168+
var_type = CategoricalDtype(categories=categories, ordered=True)
169+
else:
170+
msg = 'Missing "categories" for "{}" in metadata'.format(name)
171+
raise ValueError(msg)
169172
else:
170173
msg = 'Unknown variable type: {}'.format(var_type)
171174
raise ValueError(msg)

0 commit comments

Comments
 (0)