# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/06_ispd.ipynb.

# %% auto 0
__all__ = ['dataframe', 'pdindex', 'pdseries', 'isdf', 'isidx', 'isseries']

# %% ../nbs/06_ispd.ipynb 4
from typing import TypeGuard, ForwardRef, TypeAlias
try: from pandas import DataFrame, Index, Series
except ImportError: DataFrame, Index, Series = list, list, list
dataframe: TypeAlias = ForwardRef('pd.DataFrame', module='pandas', is_class=True)
pdindex: TypeAlias   = ForwardRef('pd.Index',     module='pandas', is_class=True)
pdseries: TypeAlias  = ForwardRef('pd.Series',    module='pandas', is_class=True)

# %% ../nbs/06_ispd.ipynb 6
def isdf(x) -> TypeGuard[dataframe]:
    '''Check if `x` is an `pd.DataFrame`.'''
    return isinstance(x, DataFrame)

def isidx(x) -> TypeGuard[pdindex]:
    '''Check if `x` is an `pd.Index`.'''
    return isinstance(x, Index)

def isseries(x) -> TypeGuard[pdseries]:
    '''Check if `x` is an `pd.Series`.'''
    return isinstance(x, Series)
