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

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

# %% ../nbs/06_ispd.ipynb 4
from typing import TypeGuard, ForwardRef, TypeAlias, Any
try: 
    from pandas import (NA, DataFrame, Index, Series)
except ImportError: 
    NA = None
    DataFrame, Index, Series = list, list, list

pdna: TypeAlias      = ForwardRef('pd.NA',        module='pandas')
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 ispdna(x) -> TypeGuard[pdna]:
    '''Check if `x` is `pd.NA`.'''
    return x is NA

def notpdna(x) -> TypeGuard[Any]:
    '''Check if `x` is not `pd.NA`.'''
    return not ispdna(x)

# %% ../nbs/06_ispd.ipynb 7
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)
