src/ei_mcoe/ei_mcoe.py
def check_agg_for_diff(raw_eia_df, qual_cols, level):
    """Check EIA qualitative data agg to see if there are outliers.

    Sometimes the pudl id does not line up with the exact EIA reporting and
    there are plants with the same pudl id and different latitudes, longitudes,
    plant names, etc. This is usually due to a difference in utility ownership.
    This function checks to see when/where that happens and makes note of it.

    Args:
        raw_eia_df (pandas.DataFrame): A DataFrame containing EIA data from the
            pudl_out.mcoe() function that has been run through the prep_raw_
            eia() function.
        qual_cols (list): A list of the columns you'd like to check to see
            whether or not they are all the same for a given pudl id.
        level (str): An string indicating the level of desired aggregation.
            Either 'plant-fuel' or 'unit-fuel' are acceptable.
    """
    # if we are on the info level (which is level 20, we don't want to do this)
    # weirdly debug is level 10, and there are seem
    if logger.level != 20:
        logger.debug(' - Checking EIA aggregation for plants with different '
                     'qualitative data')
        for col in qual_cols:
            logger.debug(f"checking for differences in: {col}")
            is_unique_df = (
                raw_eia_df.dropna(subset=[col]).groupby(
                    input_dict[level + '_index_cols'], as_index=False)
                .agg({col: (lambda x: len(x.unique()) > 1)}))
            pudl_id_deviant_list = (
                is_unique_df.loc[is_unique_df[col]]['plant_id_pudl']
                .drop_duplicates()
                .tolist())
            if pudl_id_deviant_list:
                logger.debug(
                    f' - internal differences in {col}: {pudl_id_deviant_list}'
                )
Check EIA qualitative data agg to see if there are outliers.

    Sometimes the pudl id does not line up with the exact EIA reporting and
    there are plants with the same pudl id and different latitudes, longitudes,
    plant names, etc. This is usually due to a difference in utility ownership.
    This function checks to see when/where that happens and makes note of it.

    Args:
        raw_eia_df (pandas.DataFrame): A DataFrame containing EIA data from the
            pudl_out.mcoe() function that has been run through the prep_raw_
            eia() function.
        qual_cols (list): A list of the columns you'd like to check to see
            whether or not they are all the same for a given pudl id.
        level (str): An string indicating the level of desired aggregation.
            Either 'plant-fuel' or 'unit-fuel' are acceptable.
    
Check EIA qualitative data agg to see if there are outliers.
Sometimes the pudl id does not line up with the exact EIA reporting and
there are plants with the same pudl id and different latitudes, longitudes,
plant names, etc. This is usually due to a difference in utility ownership.
This function checks to see when/where that happens and makes note of it.
Check EIA qualitative data agg to see if there are outliers . Sometimes the pudl id does not line up with the exact EIA reporting and there are plants with the same pudl id and different latitudes longitudes plant names etc . This is usually due to a difference in utility ownership . This function checks to see when / where that happens and makes note of it .
def check_agg_for_diff(raw_eia_df, qual_cols, level):
    if logger.level != 20:
        logger.debug(' - Checking EIA aggregation for plants with different '
                     'qualitative data')
        for col in qual_cols:
            logger.debug(f"checking for differences in: {col}")
            is_unique_df = (
                raw_eia_df.dropna(subset=[col]).groupby(
                    input_dict[level + '_index_cols'], as_index=False)
                .agg({col: (lambda x: len(x.unique()) > 1)}))
            pudl_id_deviant_list = (
                is_unique_df.loc[is_unique_df[col]]['plant_id_pudl']
                .drop_duplicates()
                .tolist())
            if pudl_id_deviant_list:
                logger.debug(
                    f' - internal differences in {col}: {pudl_id_deviant_list}'
                )
def check_agg_for_diff ( raw_eia_df , qual_cols , level ) : if logger . level != 20 : logger . debug ( ' - Checking EIA aggregation for plants with different ' 'qualitative data' ) for col in qual_cols : logger . debug ( f"checking for differences in: {col}" ) is_unique_df = ( raw_eia_df . dropna ( subset = [ col ] ) . groupby ( input_dict [ level + '_index_cols' ] , as_index = False ) . agg ( { col : ( lambda x : len ( x . unique ( ) ) > 1 ) } ) ) pudl_id_deviant_list = ( is_unique_df . loc [ is_unique_df [ col ] ] [ 'plant_id_pudl' ] . drop_duplicates ( ) . tolist ( ) ) if pudl_id_deviant_list : logger . debug ( f' - internal differences in {col}: {pudl_id_deviant_list}' )
Check EIA qualitative data agg to see if there are outliers.
Check EIA qualitative data agg to see if there are outliers .
"""Check EIA qualitative data agg to see if there are outliers.

    Sometimes the pudl id does not line up with the exact EIA reporting and
    there are plants with the same pudl id and different latitudes, longitudes,
    plant names, etc. This is usually due to a difference in utility ownership.
    This function checks to see when/where that happens and makes note of it.

    Args:
        raw_eia_df (pandas.DataFrame): A DataFrame containing EIA data from the
            pudl_out.mcoe() function that has been run through the prep_raw_
            eia() function.
        qual_cols (list): A list of the columns you'd like to check to see
            whether or not they are all the same for a given pudl id.
        level (str): An string indicating the level of desired aggregation.
            Either 'plant-fuel' or 'unit-fuel' are acceptable.
    """ # if we are on the info level (which is level 20, we don't want to do this) # weirdly debug is level 10, and there are seem
raw_eia_df
A DataFrame containing EIA data from the
pudl_out.mcoe() function that has been run through the prep_raw_
eia() function.
A DataFrame containing EIA data from the pudl_out . mcoe () function that has been run through the prep_raw_ eia () function .
qual_cols
A list of the columns you'd like to check to see
whether or not they are all the same for a given pudl id.
A list of the columns you ' d like to check to see whether or not they are all the same for a given pudl id .
level
An string indicating the level of desired aggregation.
Either 'plant-fuel' or 'unit-fuel' are acceptable.
An string indicating the level of desired aggregation . Either ' plant - fuel ' or ' unit - fuel ' are acceptable .