Example #1
0
def show_uniques(data: pd.DataFrame, cut: int = 10, columns: list = None) -> None:
    """Display the unique values for each column of `data`.

    Parameters
    ----------
    data : DataFrame
        DataFrame for viewing unique values.
    cut : int, optional
        Show only columns with this many or fewer uniques, by default 10.
    columns : list, optional
        Columns to show, by default None. Ignores `cut` if specified.
    """
    if columns:
        data = data.loc[:, columns]
    elif cut:
        data = data.loc[:, data.nunique() <= cut]
    cols = [pd.Series(y.dropna().unique(), name=x) for x, y in data.iteritems()]
    table = pd.concat(cols, axis=1)
    table = HTML(table.to_html(index=False, na_rep="", notebook=True))
    display(table)
Example #2
0
def printResults(results):
    results = HTML(results.to_html(escape=False))
    return results