diff --git a/pandera/api/pandas/model.py b/pandera/api/pandas/model.py index bb2c7d47..6e668a1d 100644 --- a/pandera/api/pandas/model.py +++ b/pandera/api/pandas/model.py @@ -1,9 +1,8 @@ """Class-based api for pandas models.""" -from __future__ import annotations import copy - -from typing import Any, Dict, List, Optional, Self, Tuple, Type, Union +import sys +from typing import Any, Dict, List, Optional, Tuple, Type, Union import pandas as pd @@ -24,6 +23,12 @@ DataFrame, ) +# if python version is < 3.11, import Self from typing_extensions +if sys.version_info < (3, 11): + from typing_extensions import Self +else: + from typing import Self + SchemaIndex = Union[Index, MultiIndex]