src/ei_mcoe/ei_mcoe.py
def prep_plant_fuel_data_eia(raw_eia_df):
    """Group EIA data by specified level to ready for FERC Form 1 merge.

    This function aggregates EIA data at the plant-fuel level to ready it for
    integration with FERC Form 1 cost data once it's been disaggregated with
    EIA fuel breakdown percents.

    Args:
        raw_eia_df (pandas.DataFrame): A DataFrame containing EIA data from the
            pudl_out.mcoe() function that has been run through date_to_year()
            and add_generator_age() functions.

    Returns:
        pandas.DataFrame: A DataFrame with EIA data disaggregated
            by plant and fuel ready to merge with FERC Form 1 data once it's
            been similarly disaggregated with EIA percent data.
    """
    logger.info(' - Building eia table broken down by plant and fuel type')
    raw_eia_df['eia_unit_count'] = 'place holder'
    eia_plant_fuel_df = (
        raw_eia_df.groupby(input_dict['plant-fuel_index_cols'], as_index=False)
        .agg({'total_fuel_cost': lambda x: x.sum(min_count=1),
              'net_generation_mwh': lambda x: x.sum(min_count=1),
              'capacity_mw': lambda x: x.sum(min_count=1),
              'total_mmbtu': lambda x: x.sum(min_count=1),
              # 'variable_cost': lambda x: x.sum(min_count=1),
              'eia_unit_count': lambda x: x.count()}))
    # Turn 0s into Nan values
    # eia_plant_fuel_df['variable_cost'] = (
    #    eia_plant_fuel_df['variable_cost']
    #    .apply(lambda x: None if x == 0 else x))
    return eia_plant_fuel_df
Group EIA data by specified level to ready for FERC Form 1 merge.

    This function aggregates EIA data at the plant-fuel level to ready it for
    integration with FERC Form 1 cost data once it's been disaggregated with
    EIA fuel breakdown percents.

    Args:
        raw_eia_df (pandas.DataFrame): A DataFrame containing EIA data from the
            pudl_out.mcoe() function that has been run through date_to_year()
            and add_generator_age() functions.

    Returns:
        pandas.DataFrame: A DataFrame with EIA data disaggregated
            by plant and fuel ready to merge with FERC Form 1 data once it's
            been similarly disaggregated with EIA percent data.
    
Group EIA data by specified level to ready for FERC Form 1 merge.
This function aggregates EIA data at the plant-fuel level to ready it for
integration with FERC Form 1 cost data once it's been disaggregated with
EIA fuel breakdown percents.
Group EIA data by specified level to ready for FERC Form 1 merge . This function aggregates EIA data at the plant - fuel level to ready it for integration with FERC Form 1 cost data once it ' s been disaggregated with EIA fuel breakdown percents .
def prep_plant_fuel_data_eia(raw_eia_df):
    logger.info(' - Building eia table broken down by plant and fuel type')
    raw_eia_df['eia_unit_count'] = 'place holder'
    eia_plant_fuel_df = (
        raw_eia_df.groupby(input_dict['plant-fuel_index_cols'], as_index=False)
        .agg({'total_fuel_cost': lambda x: x.sum(min_count=1),
              'net_generation_mwh': lambda x: x.sum(min_count=1),
              'capacity_mw': lambda x: x.sum(min_count=1),
              'total_mmbtu': lambda x: x.sum(min_count=1),
              'eia_unit_count': lambda x: x.count()}))
    return eia_plant_fuel_df
def prep_plant_fuel_data_eia ( raw_eia_df ) : logger . info ( ' - Building eia table broken down by plant and fuel type' ) raw_eia_df [ 'eia_unit_count' ] = 'place holder' eia_plant_fuel_df = ( raw_eia_df . groupby ( input_dict [ 'plant-fuel_index_cols' ] , as_index = False ) . agg ( { 'total_fuel_cost' : lambda x : x . sum ( min_count = 1 ) , 'net_generation_mwh' : lambda x : x . sum ( min_count = 1 ) , 'capacity_mw' : lambda x : x . sum ( min_count = 1 ) , 'total_mmbtu' : lambda x : x . sum ( min_count = 1 ) , 'eia_unit_count' : lambda x : x . count ( ) } ) ) return eia_plant_fuel_df
Group EIA data by specified level to ready for FERC Form 1 merge.
Group EIA data by specified level to ready for FERC Form 1 merge .
"""Group EIA data by specified level to ready for FERC Form 1 merge.

    This function aggregates EIA data at the plant-fuel level to ready it for
    integration with FERC Form 1 cost data once it's been disaggregated with
    EIA fuel breakdown percents.

    Args:
        raw_eia_df (pandas.DataFrame): A DataFrame containing EIA data from the
            pudl_out.mcoe() function that has been run through date_to_year()
            and add_generator_age() functions.

    Returns:
        pandas.DataFrame: A DataFrame with EIA data disaggregated
            by plant and fuel ready to merge with FERC Form 1 data once it's
            been similarly disaggregated with EIA percent data.
    """ # 'variable_cost': lambda x: x.sum(min_count=1), # Turn 0s into Nan values # eia_plant_fuel_df['variable_cost'] = ( #    eia_plant_fuel_df['variable_cost'] #    .apply(lambda x: None if x == 0 else x))
A DataFrame with EIA data disaggregated
by plant and fuel ready to merge with FERC Form 1 data once it's
been similarly disaggregated with EIA percent data.
A DataFrame with EIA data disaggregated by plant and fuel ready to merge with FERC Form 1 data once it ' s been similarly disaggregated with EIA percent data .
pandas.DataFrame
raw_eia_df
A DataFrame containing EIA data from the
pudl_out.mcoe() function that has been run through date_to_year()
and add_generator_age() functions.
A DataFrame containing EIA data from the pudl_out . mcoe () function that has been run through date_to_year () and add_generator_age () functions .