import logging


def remove_high_cardinality_numerical_columns(df, percentage_unique=1):
    """
        Purpose:
            Remove columns with the count of unique values
            matches the count of rows. These are usually
            unique identifiers (primary keys in a database)
            that are not useful for modeling and can result
            in poor model performance. percentage_unique
            defaults to 100%, but this can be passed in
        Args:
            df (Pandas DataFrame): DataFrame to remove columns
                from
            percentage_unique (float): Percentage of null values
                that will be the threshold for removing or
                keeping columns. Defaults to 1 (100%)
        Return
            df (Pandas DataFrame): DataFrame with columns removed
                based on thresholds
    """
    logging.info('Removing Unique Identifiers from DataFrame')
    logging.info(
        'Uniqueness Percentage Set to {percentage}'.format(
            percentage=percentage_unique
        )
    )

    columns_to_drop = []
    for column in df.columns:
        count_unique = df[column].nunique()
        if (count_unique / len(df.index)) >= percentage_unique:
            columns_to_drop.append(column)
            logging.info(
                'Dropping Columns {column} due to high uniqueness'.format(
                    column=column
                )
            )

    return df.drop(columns_to_drop, axis=1)