Skip to content

Commit

Permalink
Merge b23405c into cff2153
Browse files Browse the repository at this point in the history
  • Loading branch information
Genie-Liu committed Apr 12, 2019
2 parents cff2153 + b23405c commit dab2d6a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kmodes/kprototypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@ def predict(self, X, categorical=None):
Index of the cluster each sample belongs to.
"""
assert hasattr(self, '_enc_cluster_centroids'), "Model not yet fitted."

# Convert pandas objects to numpy arrays.
if 'pandas' in str(X.__class__):
X = X.values

if categorical is not None:
assert isinstance(categorical, (int, list, tuple)), "The 'categorical' \
argument needs to be an integer with the index of the categorical \
Expand Down

0 comments on commit dab2d6a

Please sign in to comment.