Skip to content

Improve error handling for datetime values when apply_log = True for InterRowMSAS #672

@fealho

Description

@fealho

Error Description

Running the compute method for InterRowMSAS with datetime values and apply_log=True raises a confusing error.

Steps to Reproduce

real_keys = pd.Series(['id1', 'id1'])
real_values = pd.Series([datetime(2020, 10, 1), datetime(2020, 10, 1)])
synthetic_keys = pd.Series(['id2', 'id2'])
synthetic_values = pd.Series([datetime(2020, 10, 1), datetime(2020, 10, 1)])

score = InterRowMSAS.compute(
    real_data=(real_keys, real_values),
    synthetic_data=(synthetic_keys, synthetic_values),
    apply_log=True,
)

The code above crashes with the following:

TypeError: ufunc 'log' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Expected Behavior

A better error message should be surfaced to the user:

Cannot compute log for datetime columns. Please set 'apply_log' to False to use this metric.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions