def frequency(data, column_name):
    """
    Creates a frequency table from a dataframe column that is suitable for
    plotting the empirical PMF, empirical CDF, or empirical CCDF.

    Args:
        data (Pandas.DataFrame): dataframe containing column to calculate
            the frequency table for.
        column_name (string): name of a single column, with discrete, including
        integer, values.

    Returns:
        Pandas.DataFrame: the frequency table
    """

    out = data[column_name].value_counts().to_frame()

    out.columns = ['frequency']
    out.index.name = column_name
    out.reset_index(inplace=True)
    out.sort_values('frequency', inplace=True, ascending=False)

    out['cumulative'] = out['frequency'].cumsum()/out['frequency'].sum()
    out['ccdf'] = 1 - out['cumulative']

    return out