def filter_by_gender(df, male):
    """Filters the data by gender.

    Args:
        df: DataFrame.
        male: True if male, False otherwise.

    Returns:
        DataFrame.
    """
    gender = 1 if male else 0
    return df[df.male == gender]