src/ei_mcoe/ei_mcoe.py
def merge_ferc1_eia_fuel_pcts(pudl_out):
    """Merge FERC Form 1 and EIA fuel percent data at the plant level.

    This function is used in the formation of the histagram in
    plot_fuel_pct_check() to see whether using EIA fuel percent breakdowns as
    a proxy for FERC is prudent.

    Args:
        pudl_out (pudl.output.pudltabl.PudlTabl): An object used to create
            the tables used for EIA and FERC analysis.

    Returns:
        pandas.DataFrame: A DataFrame with FERC Form 1 and EIA fuel breakdowns
        by plant.
    """
    eia_pcts = compile_fuel_pcts_eia(date_to_year(pudl_out.mcoe()))
    eia_pcts = (
        eia_pcts.rename(columns={
            'pct_net_generation_mwh_coal': 'coal_fraction_mmbtu',
            'pct_net_generation_mwh_gas': 'gas_fraction_mmbtu',
            'pct_net_generation_mwh_oil': 'oil_fraction_mmbtu',
            'pct_net_generation_mwh_waste': 'waste_fraction_mmbtu'})
        .drop(['pct_capacity_mw_coal', 'pct_capacity_mw_gas',
               'pct_capacity_mw_oil', 'pct_capacity_mw_waste'], axis=1))
    ferc1_fuel = pudl.transform.ferc1.fuel_by_plant_ferc1(
        pudl_out.fuel_ferc1())
    steam_ferc1 = pudl_out.plants_steam_ferc1()
    ferc_pcts = (
        pd.merge(ferc1_fuel, steam_ferc1,
                 on=['report_year', 'utility_id_ferc1', 'plant_name_ferc1'],
                 how='inner'))
    # Merge FERC and EIA860
    ferc1_eia_merge = (
        pd.merge(eia_pcts, ferc_pcts[
                 ['report_year', 'plant_id_pudl', 'coal_fraction_mmbtu',
                  'gas_fraction_mmbtu', 'oil_fraction_mmbtu',
                  'waste_fraction_mmbtu', 'coal_fraction_cost',
                  'gas_fraction_cost', 'oil_fraction_cost',
                  'waste_fraction_cost']], suffixes=('_eia', '_ferc1'),
                 on=['report_year', 'plant_id_pudl'], how='inner'))
    return ferc1_eia_merge
Merge FERC Form 1 and EIA fuel percent data at the plant level.

    This function is used in the formation of the histagram in
    plot_fuel_pct_check() to see whether using EIA fuel percent breakdowns as
    a proxy for FERC is prudent.

    Args:
        pudl_out (pudl.output.pudltabl.PudlTabl): An object used to create
            the tables used for EIA and FERC analysis.

    Returns:
        pandas.DataFrame: A DataFrame with FERC Form 1 and EIA fuel breakdowns
        by plant.
    
Merge FERC Form 1 and EIA fuel percent data at the plant level.
This function is used in the formation of the histagram in
plot_fuel_pct_check() to see whether using EIA fuel percent breakdowns as
a proxy for FERC is prudent.
Merge FERC Form 1 and EIA fuel percent data at the plant level . This function is used in the formation of the histagram in plot_fuel_pct_check () to see whether using EIA fuel percent breakdowns as a proxy for FERC is prudent .
def merge_ferc1_eia_fuel_pcts(pudl_out):
    eia_pcts = compile_fuel_pcts_eia(date_to_year(pudl_out.mcoe()))
    eia_pcts = (
        eia_pcts.rename(columns={
            'pct_net_generation_mwh_coal': 'coal_fraction_mmbtu',
            'pct_net_generation_mwh_gas': 'gas_fraction_mmbtu',
            'pct_net_generation_mwh_oil': 'oil_fraction_mmbtu',
            'pct_net_generation_mwh_waste': 'waste_fraction_mmbtu'})
        .drop(['pct_capacity_mw_coal', 'pct_capacity_mw_gas',
               'pct_capacity_mw_oil', 'pct_capacity_mw_waste'], axis=1))
    ferc1_fuel = pudl.transform.ferc1.fuel_by_plant_ferc1(
        pudl_out.fuel_ferc1())
    steam_ferc1 = pudl_out.plants_steam_ferc1()
    ferc_pcts = (
        pd.merge(ferc1_fuel, steam_ferc1,
                 on=['report_year', 'utility_id_ferc1', 'plant_name_ferc1'],
                 how='inner'))
    ferc1_eia_merge = (
        pd.merge(eia_pcts, ferc_pcts[
                 ['report_year', 'plant_id_pudl', 'coal_fraction_mmbtu',
                  'gas_fraction_mmbtu', 'oil_fraction_mmbtu',
                  'waste_fraction_mmbtu', 'coal_fraction_cost',
                  'gas_fraction_cost', 'oil_fraction_cost',
                  'waste_fraction_cost']], suffixes=('_eia', '_ferc1'),
                 on=['report_year', 'plant_id_pudl'], how='inner'))
    return ferc1_eia_merge
def merge_ferc1_eia_fuel_pcts ( pudl_out ) : eia_pcts = compile_fuel_pcts_eia ( date_to_year ( pudl_out . mcoe ( ) ) ) eia_pcts = ( eia_pcts . rename ( columns = { 'pct_net_generation_mwh_coal' : 'coal_fraction_mmbtu' , 'pct_net_generation_mwh_gas' : 'gas_fraction_mmbtu' , 'pct_net_generation_mwh_oil' : 'oil_fraction_mmbtu' , 'pct_net_generation_mwh_waste' : 'waste_fraction_mmbtu' } ) . drop ( [ 'pct_capacity_mw_coal' , 'pct_capacity_mw_gas' , 'pct_capacity_mw_oil' , 'pct_capacity_mw_waste' ] , axis = 1 ) ) ferc1_fuel = pudl . transform . ferc1 . fuel_by_plant_ferc1 ( pudl_out . fuel_ferc1 ( ) ) steam_ferc1 = pudl_out . plants_steam_ferc1 ( ) ferc_pcts = ( pd . merge ( ferc1_fuel , steam_ferc1 , on = [ 'report_year' , 'utility_id_ferc1' , 'plant_name_ferc1' ] , how = 'inner' ) ) ferc1_eia_merge = ( pd . merge ( eia_pcts , ferc_pcts [ [ 'report_year' , 'plant_id_pudl' , 'coal_fraction_mmbtu' , 'gas_fraction_mmbtu' , 'oil_fraction_mmbtu' , 'waste_fraction_mmbtu' , 'coal_fraction_cost' , 'gas_fraction_cost' , 'oil_fraction_cost' , 'waste_fraction_cost' ] ] , suffixes = ( '_eia' , '_ferc1' ) , on = [ 'report_year' , 'plant_id_pudl' ] , how = 'inner' ) ) return ferc1_eia_merge
Merge FERC Form 1 and EIA fuel percent data at the plant level.
Merge FERC Form 1 and EIA fuel percent data at the plant level .
"""Merge FERC Form 1 and EIA fuel percent data at the plant level.

    This function is used in the formation of the histagram in
    plot_fuel_pct_check() to see whether using EIA fuel percent breakdowns as
    a proxy for FERC is prudent.

    Args:
        pudl_out (pudl.output.pudltabl.PudlTabl): An object used to create
            the tables used for EIA and FERC analysis.

    Returns:
        pandas.DataFrame: A DataFrame with FERC Form 1 and EIA fuel breakdowns
        by plant.
    """ # Merge FERC and EIA860
A DataFrame with FERC Form 1 and EIA fuel breakdowns
by plant.
A DataFrame with FERC Form 1 and EIA fuel breakdowns by plant .
pandas.DataFrame
pudl_out
An object used to create
the tables used for EIA and FERC analysis.
An object used to create the tables used for EIA and FERC analysis .