HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/statsmodels/compat/patsy.py
from statsmodels.compat.pandas import PD_LT_2

import pandas as pd
import patsy.util


def _safe_is_pandas_categorical_dtype(dt):
    if PD_LT_2:
        return pd.api.types.is_categorical_dtype(dt)
    return isinstance(dt, pd.CategoricalDtype)


def monkey_patch_cat_dtype():
    patsy.util.safe_is_pandas_categorical_dtype = (
        _safe_is_pandas_categorical_dtype
    )