Skip to content

Commit

Permalink
Filtered valid category values
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Jan 7, 2024
1 parent 20cfa72 commit 7b37433
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sklearn2pmml/preprocessing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def __init__(self, dtype):

def fit(self, X, y = None):
if self.dtype == "category":
categories = numpy.unique(X)
nonmissing_mask = pandas.notnull(X)
categories = numpy.unique(X[nonmissing_mask])
self.dtype_ = CategoricalDtype(categories, ordered = False)
else:
self.dtype_ = self.dtype
Expand Down

0 comments on commit 7b37433

Please sign in to comment.