def _disallow_invalid_ops(self, dtype: DtypeObj, is_numeric: bool=False):
    '\n        Check if we can do this operation with our cython functions.\n\n        Raises\n        ------\n        NotImplementedError\n            This is either not a valid function for this dtype, or\n            valid but not implemented in cython.\n        '
    how = self.how
    if is_numeric:
        return
    if is_categorical_dtype(dtype):
        if (how in ['add', 'prod', 'cumsum', 'cumprod']):
            raise TypeError(f'{dtype} type does not support {how} operations')
        raise NotImplementedError(f'{dtype} dtype not supported')
    elif is_sparse(dtype):
        raise NotImplementedError(f'{dtype} dtype not supported')
    elif is_datetime64_any_dtype(dtype):
        if (how in ['add', 'prod', 'cumsum', 'cumprod']):
            raise TypeError(f'datetime64 type does not support {how} operations')
    elif is_timedelta64_dtype(dtype):
        if (how in ['prod', 'cumprod']):
            raise TypeError(f'timedelta64 type does not support {how} operations')
Check if we can do this operation with our cython functions.

Raises
------
NotImplementedError
    This is either not a valid function for this dtype, or
    valid but not implemented in cython.
def _disallow_invalid_ops(self, dtype: DtypeObj, is_numeric: bool=False):
    '\n        Check if we can do this operation with our cython functions.\n\n        Raises\n        ------\n        NotImplementedError\n            This is either not a valid function for this dtype, or\n            valid but not implemented in cython.\n        '
    how = self.how
    if is_numeric:
        return
    if is_categorical_dtype(dtype):
        if (how in ['add', 'prod', 'cumsum', 'cumprod']):
            raise TypeError(f'{dtype} type does not support {how} operations')
        raise NotImplementedError(f'{dtype} dtype not supported')
    elif is_sparse(dtype):
        raise NotImplementedError(f'{dtype} dtype not supported')
    elif is_datetime64_any_dtype(dtype):
        if (how in ['add', 'prod', 'cumsum', 'cumprod']):
            raise TypeError(f'datetime64 type does not support {how} operations')
    elif is_timedelta64_dtype(dtype):
        if (how in ['prod', 'cumprod']):
            raise TypeError(f'timedelta64 type does not support {how} operations')