def filter(self, items: Optional[Sequence[Any]]=None, like: Optional[str]=None, regex: Optional[str]=None, axis: Optional[Axis]=None) -> 'DataFrame':
    '\n        Subset rows or columns of dataframe according to labels in\n        the specified index.\n\n        Note that this routine does not filter a dataframe on its\n        contents. The filter is applied to the labels of the index.\n\n        Parameters\n        ----------\n        items : list-like\n            Keep labels from axis which are in items.\n        like : string\n            Keep labels from axis for which "like in label == True".\n        regex : string (regular expression)\n            Keep labels from axis for which re.search(regex, label) == True.\n        axis : int or string axis name\n            The axis to filter on.  By default this is the info axis,\n            \'index\' for Series, \'columns\' for DataFrame.\n\n        Returns\n        -------\n        same type as input object\n\n        See Also\n        --------\n        DataFrame.loc\n\n        Notes\n        -----\n        The ``items``, ``like``, and ``regex`` parameters are\n        enforced to be mutually exclusive.\n\n        ``axis`` defaults to the info axis that is used when indexing\n        with ``[]``.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame(np.array(([1, 2, 3], [4, 5, 6])),\n        ...                   index=[\'mouse\', \'rabbit\'],\n        ...                   columns=[\'one\', \'two\', \'three\'])\n\n        >>> # select columns by name\n        >>> df.filter(items=[\'one\', \'three\'])\n                one  three\n        mouse     1      3\n        rabbit    4      6\n\n        >>> # select columns by regular expression\n        >>> df.filter(regex=\'e$\', axis=1)\n                one  three\n        mouse     1      3\n        rabbit    4      6\n\n        >>> # select rows containing \'bbi\'\n        >>> df.filter(like=\'bbi\', axis=0)\n                one  two  three\n        rabbit    4    5      6\n\n        For a Series,\n\n        >>> # select rows by name\n        >>> df.one.filter(items=[\'rabbit\'])\n        rabbit    4\n        Name: one, dtype: int64\n\n        >>> # select rows by regular expression\n        >>> df.one.filter(regex=\'e$\')\n        mouse    1\n        Name: one, dtype: int64\n\n        >>> # select rows containing \'bbi\'\n        >>> df.one.filter(like=\'bbi\')\n        rabbit    4\n        Name: one, dtype: int64\n        '
    if (sum(((x is not None) for x in (items, like, regex))) > 1):
        raise TypeError('Keyword arguments `items`, `like`, or `regex` are mutually exclusive')
    axis = validate_axis(axis, none_axis=1)
    index_scols = self._internal.index_spark_columns
    if (items is not None):
        if is_list_like(items):
            items = list(items)
        else:
            raise ValueError('items should be a list-like object.')
        if (axis == 0):
            if (len(index_scols) == 1):
                if (len(items) <= ps.get_option('compute.isin_limit')):
                    col = index_scols[0].isin([SF.lit(item) for item in items])
                    return DataFrame(self._internal.with_filter(col))
                else:
                    item_sdf_col = verify_temp_column_name(self._internal.spark_frame, '__item__')
                    item_sdf = default_session().createDataFrame(pd.DataFrame({item_sdf_col: items}))
                    joined_sdf = self._internal.spark_frame.join(other=F.broadcast(item_sdf), on=(index_scols[0] == scol_for(item_sdf, item_sdf_col)), how='semi')
                    return DataFrame(self._internal.with_new_sdf(joined_sdf))
            else:
                col = None
                for item in items:
                    if (not isinstance(item, tuple)):
                        raise TypeError('Unsupported type {}'.format(type(item).__name__))
                    if (not item):
                        raise ValueError('The item should not be empty.')
                    midx_col = None
                    for (i, element) in enumerate(item):
                        if (midx_col is None):
                            midx_col = (index_scols[i] == SF.lit(element))
                        else:
                            midx_col = (midx_col & (index_scols[i] == SF.lit(element)))
                    if (col is None):
                        col = midx_col
                    else:
                        col = (col | midx_col)
                return DataFrame(self._internal.with_filter(col))
        else:
            return self[items]
    elif (like is not None):
        if (axis == 0):
            col = None
            for index_scol in index_scols:
                if (col is None):
                    col = index_scol.contains(like)
                else:
                    col = (col | index_scol.contains(like))
            return DataFrame(self._internal.with_filter(col))
        else:
            column_labels = self._internal.column_labels
            output_labels = [label for label in column_labels if any(((like in i) for i in label))]
            return self[output_labels]
    elif (regex is not None):
        if (axis == 0):
            col = None
            for index_scol in index_scols:
                if (col is None):
                    col = index_scol.rlike(regex)
                else:
                    col = (col | index_scol.rlike(regex))
            return DataFrame(self._internal.with_filter(col))
        else:
            column_labels = self._internal.column_labels
            matcher = re.compile(regex)
            output_labels = [label for label in column_labels if any(((matcher.search(i) is not None) for i in label))]
            return self[output_labels]
    else:
        raise TypeError('Must pass either `items`, `like`, or `regex`')
Subset rows or columns of dataframe according to labels in
the specified index.

Note that this routine does not filter a dataframe on its
contents. The filter is applied to the labels of the index.

Parameters
----------
items : list-like
    Keep labels from axis which are in items.
like : string
    Keep labels from axis for which "like in label == True".
regex : string (regular expression)
    Keep labels from axis for which re.search(regex, label) == True.
axis : int or string axis name
    The axis to filter on.  By default this is the info axis,
    'index' for Series, 'columns' for DataFrame.

Returns
-------
same type as input object

See Also
--------
DataFrame.loc

Notes
-----
The ``items``, ``like``, and ``regex`` parameters are
enforced to be mutually exclusive.

``axis`` defaults to the info axis that is used when indexing
with ``[]``.

Examples
--------
>>> df = ps.DataFrame(np.array(([1, 2, 3], [4, 5, 6])),
...                   index=['mouse', 'rabbit'],
...                   columns=['one', 'two', 'three'])

>>> # select columns by name
>>> df.filter(items=['one', 'three'])
        one  three
mouse     1      3
rabbit    4      6

>>> # select columns by regular expression
>>> df.filter(regex='e$', axis=1)
        one  three
mouse     1      3
rabbit    4      6

>>> # select rows containing 'bbi'
>>> df.filter(like='bbi', axis=0)
        one  two  three
rabbit    4    5      6

For a Series,

>>> # select rows by name
>>> df.one.filter(items=['rabbit'])
rabbit    4
Name: one, dtype: int64

>>> # select rows by regular expression
>>> df.one.filter(regex='e$')
mouse    1
Name: one, dtype: int64

>>> # select rows containing 'bbi'
>>> df.one.filter(like='bbi')
rabbit    4
Name: one, dtype: int64
def filter(self, items: Optional[Sequence[Any]]=None, like: Optional[str]=None, regex: Optional[str]=None, axis: Optional[Axis]=None) -> 'DataFrame':
    '\n        Subset rows or columns of dataframe according to labels in\n        the specified index.\n\n        Note that this routine does not filter a dataframe on its\n        contents. The filter is applied to the labels of the index.\n\n        Parameters\n        ----------\n        items : list-like\n            Keep labels from axis which are in items.\n        like : string\n            Keep labels from axis for which "like in label == True".\n        regex : string (regular expression)\n            Keep labels from axis for which re.search(regex, label) == True.\n        axis : int or string axis name\n            The axis to filter on.  By default this is the info axis,\n            \'index\' for Series, \'columns\' for DataFrame.\n\n        Returns\n        -------\n        same type as input object\n\n        See Also\n        --------\n        DataFrame.loc\n\n        Notes\n        -----\n        The ``items``, ``like``, and ``regex`` parameters are\n        enforced to be mutually exclusive.\n\n        ``axis`` defaults to the info axis that is used when indexing\n        with ``[]``.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame(np.array(([1, 2, 3], [4, 5, 6])),\n        ...                   index=[\'mouse\', \'rabbit\'],\n        ...                   columns=[\'one\', \'two\', \'three\'])\n\n        >>> # select columns by name\n        >>> df.filter(items=[\'one\', \'three\'])\n                one  three\n        mouse     1      3\n        rabbit    4      6\n\n        >>> # select columns by regular expression\n        >>> df.filter(regex=\'e$\', axis=1)\n                one  three\n        mouse     1      3\n        rabbit    4      6\n\n        >>> # select rows containing \'bbi\'\n        >>> df.filter(like=\'bbi\', axis=0)\n                one  two  three\n        rabbit    4    5      6\n\n        For a Series,\n\n        >>> # select rows by name\n        >>> df.one.filter(items=[\'rabbit\'])\n        rabbit    4\n        Name: one, dtype: int64\n\n        >>> # select rows by regular expression\n        >>> df.one.filter(regex=\'e$\')\n        mouse    1\n        Name: one, dtype: int64\n\n        >>> # select rows containing \'bbi\'\n        >>> df.one.filter(like=\'bbi\')\n        rabbit    4\n        Name: one, dtype: int64\n        '
    if (sum(((x is not None) for x in (items, like, regex))) > 1):
        raise TypeError('Keyword arguments `items`, `like`, or `regex` are mutually exclusive')
    axis = validate_axis(axis, none_axis=1)
    index_scols = self._internal.index_spark_columns
    if (items is not None):
        if is_list_like(items):
            items = list(items)
        else:
            raise ValueError('items should be a list-like object.')
        if (axis == 0):
            if (len(index_scols) == 1):
                if (len(items) <= ps.get_option('compute.isin_limit')):
                    col = index_scols[0].isin([SF.lit(item) for item in items])
                    return DataFrame(self._internal.with_filter(col))
                else:
                    item_sdf_col = verify_temp_column_name(self._internal.spark_frame, '__item__')
                    item_sdf = default_session().createDataFrame(pd.DataFrame({item_sdf_col: items}))
                    joined_sdf = self._internal.spark_frame.join(other=F.broadcast(item_sdf), on=(index_scols[0] == scol_for(item_sdf, item_sdf_col)), how='semi')
                    return DataFrame(self._internal.with_new_sdf(joined_sdf))
            else:
                col = None
                for item in items:
                    if (not isinstance(item, tuple)):
                        raise TypeError('Unsupported type {}'.format(type(item).__name__))
                    if (not item):
                        raise ValueError('The item should not be empty.')
                    midx_col = None
                    for (i, element) in enumerate(item):
                        if (midx_col is None):
                            midx_col = (index_scols[i] == SF.lit(element))
                        else:
                            midx_col = (midx_col & (index_scols[i] == SF.lit(element)))
                    if (col is None):
                        col = midx_col
                    else:
                        col = (col | midx_col)
                return DataFrame(self._internal.with_filter(col))
        else:
            return self[items]
    elif (like is not None):
        if (axis == 0):
            col = None
            for index_scol in index_scols:
                if (col is None):
                    col = index_scol.contains(like)
                else:
                    col = (col | index_scol.contains(like))
            return DataFrame(self._internal.with_filter(col))
        else:
            column_labels = self._internal.column_labels
            output_labels = [label for label in column_labels if any(((like in i) for i in label))]
            return self[output_labels]
    elif (regex is not None):
        if (axis == 0):
            col = None
            for index_scol in index_scols:
                if (col is None):
                    col = index_scol.rlike(regex)
                else:
                    col = (col | index_scol.rlike(regex))
            return DataFrame(self._internal.with_filter(col))
        else:
            column_labels = self._internal.column_labels
            matcher = re.compile(regex)
            output_labels = [label for label in column_labels if any(((matcher.search(i) is not None) for i in label))]
            return self[output_labels]
    else:
        raise TypeError('Must pass either `items`, `like`, or `regex`')