Skip to content

Mahalanobis.fit unexpectedly raises error when no categorical variables are present #905

@sfo

Description

@sfo

The following implementation for the fit-method's parameter validation raises an exception when there is no cat_vars parameter given in the object's constructor:

if self.cat_vars is None:
raise TypeError('No categorical variables specified in the "cat_vars" argument.')

However, the documentation says (emphasize mine):

cat_vars: dictionary with as keys the categorical columns and as values the number of categories per categorical variable. Only needed if categorical variables are present.

Even in the docstring of the function itself it states:

If categorical variables are present, then transform those to numerical values.
This step is not necessary in the absence of categorical variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions