def _is_pandas_df(X):
        """Return True if the X is a pandas dataframe."""
        try:
            pd = sys.modules["pandas"]
        except KeyError:
            return False
        return isinstance(X, pd.DataFrame)
Return True if the X is a pandas dataframe.
imblearn/utils/_sklearn_compat.py