def top_district(df, rank_filter):
    """
    Method for finding the total number of audience in the district

    Args:
        df (pandas dataframe): Dataframe from clean_data
        rank_filter (int): Number of top districts to display

    Returns:
        data (list): Return list of (x, y) value for plotting
    """

    # Groupby district name and sum the number of audiences
    df = df.groupby(["districtName"], as_index = False)["count_id"].agg("sum")

    # Sort values in descending order
    df.sort_values(by = ["count_id"], ascending = False, inplace = True)

    # Slice the rows to select top n rows
    df = df[:rank_filter]
    
    #return data
    return df