Returns a sub-dataframe by the logical or over the given masks.

    Parameters
    ----------
    df : pandas.DataFrame
        The dataframe to take a subframe of.
    masks : list
        A list of pandas.Series of dtype bool, indexed identically to the given
        dataframe.

    Returns
    -------
    pandas.DataFrame
        The sub-dataframe resulting from applying the masks to the dataframe.

    Example
    -------
    >>> import pandas as pd
    >>> data = [[23, 'Jo'], [19, 'Mi'], [15, 'Di']]
    >>> df = pd.DataFrame(data, [1, 2, 3] , ['Age', 'Name'])
    >>> mask1 = pd.Series([False, True, True], df.index)
    >>> mask2 = pd.Series([False, False, True], df.index)
    >>> or_by_masks(df, [mask1, mask2])
       Age Name
    2   19   Mi
    3   15   Di

def or_by_masks(df, masks):
    """Returns a sub-dataframe by the logical or over the given masks.

    Parameters
    ----------
    df : pandas.DataFrame
        The dataframe to take a subframe of.
    masks : list
        A list of pandas.Series of dtype bool, indexed identically to the given
        dataframe.

    Returns
    -------
    pandas.DataFrame
        The sub-dataframe resulting from applying the masks to the dataframe.

    Example
    -------
    >>> import pandas as pd
    >>> data = [[23, 'Jo'], [19, 'Mi'], [15, 'Di']]
    >>> df = pd.DataFrame(data, [1, 2, 3] , ['Age', 'Name'])
    >>> mask1 = pd.Series([False, True, True], df.index)
    >>> mask2 = pd.Series([False, False, True], df.index)
    >>> or_by_masks(df, [mask1, mask2])
       Age Name
    2   19   Mi
    3   15   Di
    """
    if len(masks) < 1:
        return df
    if len(masks) == 1:
        return df[masks[0]]
    overall_mask = masks[0] | masks[1]
    for mask in masks[2:]:
        overall_mask = overall_mask | mask
    return df[overall_mask]