Skip to content

Commit 4aeca74

Browse files
committed
Fix unsupported use of union type operator
1 parent eef6538 commit 4aeca74

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/sensai/util/plot.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import collections
21
import logging
32
from typing import Sequence, Callable, TypeVar, Tuple, Optional, List, Any, Union, Dict
43

@@ -440,14 +439,14 @@ class MetricComparisonBarPlot(Plot):
440439
MetricComparisonBarPlot(df)
441440
```
442441
"""
443-
def __init__(self, df: pd.DataFrame, ax: plt.Axes | None = None, metric_label="metric", value_label="value", entity_label="model"):
442+
def __init__(self, df: pd.DataFrame, ax: Optional[plt.Axes] = None, metric_label="metric", value_label="value", entity_label="model"):
444443
"""
445444
:param df: a data frame with metrics values, where the index specifies the names of compared entities (e.g. model names)
446445
and the columns are different metrics
447446
:param ax: the axis to plot to; if None, create it, with the height being automatically adjusted
448447
"""
449448

450-
def draw(ax: plt.Axes | None):
449+
def draw(ax: Optional[plt.Axes]):
451450
index_name = df.index.name or "index"
452451
df_melted = df.reset_index().melt(id_vars=index_name, var_name=metric_label, value_name=value_label)
453452
df_melted.rename(columns={index_name: entity_label}, inplace=True)

0 commit comments

Comments
 (0)