When a categorical column contains pd.NA values, running a preset like DataSummaryPreset crashes with a pydantic ValidationError.
Root cause: convert_types() calls np.isnan(val) without a type guard. np.isnan(pd.NA) raises TypeError because pd.NA doesn't support the isnan protocol.
Repro from #1616:
import pandas as pd
from evidently import DataDefinition, Dataset
from evidently.presets import DataSummaryPreset, Report
df = pd.DataFrame({"a": pd.Series(["x", "y", "z", pd.NA], dtype="str")})
definition = DataDefinition(categorical_columns=["a"])
report = Report([DataSummaryPreset()])
data = Dataset.from_pandas(df, definition)
report.run(current_data=data)
Traceback ends at metric_types.py in convert_types — np.isnan(val) where val is pd.NA.
When a categorical column contains pd.NA values, running a preset like DataSummaryPreset crashes with a pydantic ValidationError.
Root cause: convert_types() calls np.isnan(val) without a type guard. np.isnan(pd.NA) raises TypeError because pd.NA doesn't support the isnan protocol.
Repro from #1616:
Traceback ends at
metric_types.pyin convert_types —np.isnan(val)where val is pd.NA.