Repository: evidentlyai/evidently
Issue: Error on eval_drift - missing index
Root cause: Validation Gap

The notebook doesn't work with the sample dataset. It fails on eval_drift() step with 'index' KeyError when executing get_drift_for_columns()

Hi @hrumichal, are you referring to Evidently example notebooks? If yes, could you point to which one? Thanks! 

It's the mlflow integration example.

On Mon 22. 5. 2023 at 13:57, elenasamuylova ***@***.***>
wrote:

> Hi @hrumichal <https://github.com/hrumichal>, are you referring to
> Evidently example notebooks? If yes, could you point to which one? Thanks!
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/evidentlyai/evidently/issues/609#issuecomment-1557087786>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/APSO4W7VZW3GSMCRQDTU42TXHNIC5ANCNFSM6AAAAAAYJ77ROQ>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
-- 
S pozdravem
Michal Hruška


Facing the same error. 
Here is the script: https://github.com/neptune-ai/examples/blob/main/integrations-and-supported-tools/evidently/scripts/Neptune_Evidently_drifts.py
It is based on the MLflow example notebook: https://docs.evidentlyai.com/integrations/evidently-and-mlflow

**Traceback**
```
  File "Neptune_Evidently_drifts.py", line 102, in <module>
    metrics = eval_drift(
  File "Neptune_Evidently_drifts.py", line 44, in eval_drift
    report = data_drift_report.as_dict()
  File "C:\Users\siddh\miniconda3\envs\py38\lib\site-packages\evidently\report\report.py", line 125, in as_dict
    "result": renderer.render_json(
  File "C:\Users\siddh\miniconda3\envs\py38\lib\site-packages\evidently\renderers\base_renderer.py", line 44, in render_json
    result = obj.get_result()
  File "C:\Users\siddh\miniconda3\envs\py38\lib\site-packages\evidently\base_metric.py", line 168, in get_result
    raise result.exception
  File "C:\Users\siddh\miniconda3\envs\py38\lib\site-packages\evidently\suite\base_suite.py", line 324, in run_calculate
    calculations[calculation] = calculation.calculate(data)
  File "C:\Users\siddh\miniconda3\envs\py38\lib\site-packages\evidently\metrics\data_drift\dataset_drift_metric.py", line 74, in calculate
    result = get_drift_for_columns(
  File "C:\Users\siddh\miniconda3\envs\py38\lib\site-packages\evidently\calculations\data_drift.py", line 419, in get_drift_for_columns  
    drift_by_columns[column_name] = get_one_column_drift(
  File "C:\Users\siddh\miniconda3\envs\py38\lib\site-packages\evidently\calculations\data_drift.py", line 196, in get_one_column_drift   
    df, prefix = prepare_df_for_time_index_plot(
  File "C:\Users\siddh\miniconda3\envs\py38\lib\site-packages\evidently\utils\visualizations.py", line 985, in prepare_df_for_time_index_plot
    plot_df = df[column_name].reset_index().sort_values("index")
  File "C:\Users\siddh\miniconda3\envs\py38\lib\site-packages\pandas\core\frame.py", line 6768, in sort_values
    k = self._get_label_or_level_values(by, axis=axis)
  File "C:\Users\siddh\miniconda3\envs\py38\lib\site-packages\pandas\core\generic.py", line 1778, in _get_label_or_level_values
    raise KeyError(key)
KeyError: 'index'
```

**Dependencies**
evidently==0.3.2.1
pandas==2.0.1

Hi @hrumichal, @SiddhantSadangi!
Thanks for letting us know about this issue! We have fixed the error and the changes will be available in the next release.

fixed in https://github.com/evidentlyai/evidently/pull/623