src/ei_mcoe/ei_mcoe.py
def calc_fuel_pcts_eia(eia_plant_fuel_df, pct_col1, pct_col2):
    """Calculate the fuel type breakdown for input columns.

    For use specifically in the eia_fuel_pcts() function where a DataFrame
    containing eia data aggragated by fuel type and plant totals is created.

    Args:
        eia_plant_fuel_df (pandas.DataFrame): A DataFrame containing eia data
            with values aggregated by plant fuel type AND plant total.
        pct_col1 (str): A single column name to be broken down by fuel
            type.
        pct_col2 (str): A single column name to be broken down by fuel
            type.

    Returns:
        pandas.DataFrame: A DataFrame containing the percent breakdown by
            fuel type of pct_col1. Merged with that of pct_col2.
    """
    logger.info(' -- Calculating eia fuel type percentages')
    # Calculate percent that each fuel contributes to input cols
    # (capcity and net gen in this case)
    eia_plant_fuel_df['pct_' + pct_col1] = (
        eia_plant_fuel_df[pct_col1 + '_fuel_level'] /
        eia_plant_fuel_df[pct_col1 + '_plant_level'])
    eia_plant_fuel_df['pct_' + pct_col2] = (
        eia_plant_fuel_df[pct_col2 + '_fuel_level'] /
        eia_plant_fuel_df[pct_col2 + '_plant_level'])
    # Reorient table so that fuel type percents become columns
    # (makes it easier to run calculations on FERC1 data)
    pct_df1 = fuel_type_to_col_eia(eia_plant_fuel_df, pct_col1)
    pct_df2 = fuel_type_to_col_eia(eia_plant_fuel_df, pct_col2)
    # Merge percent dfs so that they are both included.
    # pd.merge will not take a df list.
    eia_pct_df = (
        pd.merge(pct_df1, pct_df2, on=input_dict['plant_index_cols'],
                 how='outer'))
    return eia_pct_df
Calculate the fuel type breakdown for input columns.

    For use specifically in the eia_fuel_pcts() function where a DataFrame
    containing eia data aggragated by fuel type and plant totals is created.

    Args:
        eia_plant_fuel_df (pandas.DataFrame): A DataFrame containing eia data
            with values aggregated by plant fuel type AND plant total.
        pct_col1 (str): A single column name to be broken down by fuel
            type.
        pct_col2 (str): A single column name to be broken down by fuel
            type.

    Returns:
        pandas.DataFrame: A DataFrame containing the percent breakdown by
            fuel type of pct_col1. Merged with that of pct_col2.
    
Calculate the fuel type breakdown for input columns.
For use specifically in the eia_fuel_pcts() function where a DataFrame
containing eia data aggragated by fuel type and plant totals is created.
Calculate the fuel type breakdown for input columns . For use specifically in the eia_fuel_pcts () function where a DataFrame containing eia data aggragated by fuel type and plant totals is created .
def calc_fuel_pcts_eia(eia_plant_fuel_df, pct_col1, pct_col2):
    logger.info(' -- Calculating eia fuel type percentages')
    eia_plant_fuel_df['pct_' + pct_col1] = (
        eia_plant_fuel_df[pct_col1 + '_fuel_level'] /
        eia_plant_fuel_df[pct_col1 + '_plant_level'])
    eia_plant_fuel_df['pct_' + pct_col2] = (
        eia_plant_fuel_df[pct_col2 + '_fuel_level'] /
        eia_plant_fuel_df[pct_col2 + '_plant_level'])
    pct_df1 = fuel_type_to_col_eia(eia_plant_fuel_df, pct_col1)
    pct_df2 = fuel_type_to_col_eia(eia_plant_fuel_df, pct_col2)
    eia_pct_df = (
        pd.merge(pct_df1, pct_df2, on=input_dict['plant_index_cols'],
                 how='outer'))
    return eia_pct_df
def calc_fuel_pcts_eia ( eia_plant_fuel_df , pct_col1 , pct_col2 ) : logger . info ( ' -- Calculating eia fuel type percentages' ) eia_plant_fuel_df [ 'pct_' + pct_col1 ] = ( eia_plant_fuel_df [ pct_col1 + '_fuel_level' ] / eia_plant_fuel_df [ pct_col1 + '_plant_level' ] ) eia_plant_fuel_df [ 'pct_' + pct_col2 ] = ( eia_plant_fuel_df [ pct_col2 + '_fuel_level' ] / eia_plant_fuel_df [ pct_col2 + '_plant_level' ] ) pct_df1 = fuel_type_to_col_eia ( eia_plant_fuel_df , pct_col1 ) pct_df2 = fuel_type_to_col_eia ( eia_plant_fuel_df , pct_col2 ) eia_pct_df = ( pd . merge ( pct_df1 , pct_df2 , on = input_dict [ 'plant_index_cols' ] , how = 'outer' ) ) return eia_pct_df
Calculate the fuel type breakdown for input columns.
Calculate the fuel type breakdown for input columns .
"""Calculate the fuel type breakdown for input columns.

    For use specifically in the eia_fuel_pcts() function where a DataFrame
    containing eia data aggragated by fuel type and plant totals is created.

    Args:
        eia_plant_fuel_df (pandas.DataFrame): A DataFrame containing eia data
            with values aggregated by plant fuel type AND plant total.
        pct_col1 (str): A single column name to be broken down by fuel
            type.
        pct_col2 (str): A single column name to be broken down by fuel
            type.

    Returns:
        pandas.DataFrame: A DataFrame containing the percent breakdown by
            fuel type of pct_col1. Merged with that of pct_col2.
    """ # Calculate percent that each fuel contributes to input cols # (capcity and net gen in this case) # Reorient table so that fuel type percents become columns # (makes it easier to run calculations on FERC1 data) # Merge percent dfs so that they are both included. # pd.merge will not take a df list.
A DataFrame containing the percent breakdown by
fuel type of pct_col1. Merged with that of pct_col2.
A DataFrame containing the percent breakdown by fuel type of pct_col1 . Merged with that of pct_col2 .
pandas.DataFrame
eia_plant_fuel_df
A DataFrame containing eia data
with values aggregated by plant fuel type AND plant total.
A DataFrame containing eia data with values aggregated by plant fuel type AND plant total .
pct_col1
A single column name to be broken down by fuel
type.
A single column name to be broken down by fuel type .
pct_col2
A single column name to be broken down by fuel
type.
A single column name to be broken down by fuel type .