evidently icon indicating copy to clipboard operation
evidently copied to clipboard

Error when a report is run without reference_data even though it is optional

Open abhitoqua opened this issue 3 years ago • 3 comments

Issue: When generating a report with DataQualityPreset() metric, the reference_data is optional as described here. However, calling this method without reference_data leads to this error:

data_quality_report.run(current_data=current_data,column_mapping=column_mapping)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_4117/1444958639.py in <module>
      1 column_mapping = ColumnMapping(datetime="datetime_end",numerical_features=features[1:])
----> 2 data_quality_report.run(current_data=current_data,column_mapping=column_mapping)

TypeError: run() missing 1 required keyword-only argument: 'reference_data'

Cause:

The reference_data argument is optional when running the run() method of Report class https://github.com/evidentlyai/evidently/blob/098b95b9343c390ba9910be4bb85755215b7d8b2/src/evidently/report/report.py#L42

But it is not assigned a None unlike column_mapping here: https://github.com/evidentlyai/evidently/blob/098b95b9343c390ba9910be4bb85755215b7d8b2/src/evidently/report/report.py#L44

Solution (suggestion):

Initialize the optional reference_data as None in https://github.com/evidentlyai/evidently/blob/098b95b9343c390ba9910be4bb85755215b7d8b2/src/evidently/report/report.py#L42

abhitoqua avatar Feb 24 '23 14:02 abhitoqua

I am experiencing the same problem.

GwenVCX avatar Nov 06 '23 23:11 GwenVCX

Hi @GwenVCX, @abhitoqua,

You should pass the reference data as None in this scenario.

data_quality_report = Report(metrics=[
    DataQualityPreset()
])

data_quality_report.run(current_data=current, reference_data=None)
data_quality_report  

elenasamuylova avatar Nov 06 '23 23:11 elenasamuylova

That worked. Thank you @elenasamuylova!

GwenVCX avatar Nov 07 '23 00:11 GwenVCX