# Buggy code
def _filter_is_defined(self, columns=None, negate=False):
    if columns is None:
        if sp.issparse(self.X):
            remove = self.X.indptr[1:] != self.X.indptr[-1:] + self.X.shape[1]
        else:
            remove = bn.anynan(self.X, axis=1)
        if sp.issparse(self._Y):
            remove = np.logical_or(
                remove, self._Y.indptr[1:] != self._Y.indptr[-1:] + self._Y.shape[1]
            )
        else:
            remove = np.logical_or(remove, bn.anynan(self._Y, axis=1))
    else:
        remove = np.zeros(len(self), dtype=bool)
        for column in columns:
            col, sparse = self.get_column_view(column)
            if sparse:
                remove = np.logical_or(remove, col == 0)
            else:
                remove = np.logical_or(remove, bn.anynan([col], axis=0))
    retain = remove if negate else np.logical_not(remove)
    return self.from_table_rows(self, retain)


# Traceback (TypeError)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "<string>", line 10, in <module>
File "C:\Users\reads\AppData\Local\Continuum\miniconda3\envs\orange-spectroscopy\lib\site-packages\Orange\data\filter.py", line 64, in __call__
return data._filter_is_defined(self.columns, self.negate)
File "C:\Users\reads\AppData\Local\Continuum\miniconda3\envs\orange-spectroscopy\lib\site-packages\Orange\data\table.py", line 1141, in _filter_is_defined
remove = np.logical_or(remove, bn.anynan([col], axis=0))
File "C:\Users\reads\AppData\Local\Continuum\miniconda3\envs\orange-spectroscopy\lib\site-packages\bottleneck\slow\reduce.py", line 86, in anynan
return np.isnan(a).any(axis)
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

# Fixed code
def _filter_is_defined(self, columns=None, negate=False):
    # structure of function is obvious; pylint: disable=too-many-branches
    def _sp_anynan(a):
        return a.indptr[1:] != a[-1:] + a.shape[1]

    if columns is None:
        if sp.issparse(self.X):
            remove = _sp_anynan(self.X)
        else:
            remove = bn.anynan(self.X, axis=1)
        if sp.issparse(self._Y):
            remove += _sp_anynan(self._Y)
        else:
            remove += bn.anynan(self._Y, axis=1)
        if sp.issparse(self.metas):
            remove += _sp_anynan(self._metas)
        else:
            for i, var in enumerate(self.domain.metas):
                col = self.metas[:, i].flatten()
                if var.is_primitive():
                    remove += np.isnan(col.astype(float))
                else:
                    remove += ~col.astype(bool)
    else:
        remove = np.zeros(len(self), dtype=bool)
        for column in columns:
            col, sparse = self.get_column_view(column)
            if sparse:
                remove += col == 0
            elif self.domain[column].is_primitive():
                remove += bn.anynan([col.astype(float)], axis=0)
            else:
                remove += col.astype(bool)
    retain = remove if negate else np.logical_not(remove)
    return self.from_table_rows(self, retain)