src/ei_mcoe/ei_mcoe.py
def eliminate_retired_plants(raw_eia_all_plants_df):
    """Eliminate plants with retirement dates.

    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.
    Returns:
        pandas.DataFrame: A DataFrame containing raw EIA data without plants
            that have been retired.

    """
    logger.info('Eliminating retired plants')
    # Read recent EIA file containing retirement info
    retired_df = (
        pd.read_excel(
            ei_mcoe.INPUTS_DIR / 'february_generator2020.xlsx',
            'Retired', header=1,
            dtype={'Generator ID': 'str',
                   'Plant ID': 'Int64',
                   'Retirement Year': 'Int64'})
        .rename(columns={'Plant ID': 'plant_id_eia',
                         'Generator ID': 'generator_id',
                         'Retirement Year': 'retirement_year'}))
    # Keep relevant columns
    retired_df = retired_df[['plant_id_eia', 'generator_id',
                             'retirement_year']]
    # Merge raw EIA data with retired generators data and delete those with
    # retirement dates
    raw_with_retired_df = (
        pd.merge(raw_eia_all_plants_df, retired_df,
                 on=['plant_id_eia', 'generator_id'], how='left'))
    raw_no_retired_df = (
        raw_with_retired_df.loc[raw_with_retired_df['retirement_year'].isna()]
        .drop('retirement_year', axis=1))
    return raw_no_retired_df
Eliminate plants with retirement dates.

    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.
    Returns:
        pandas.DataFrame: A DataFrame containing raw EIA data without plants
            that have been retired.

    
Eliminate plants with retirement dates.
Eliminate plants with retirement dates .
def eliminate_retired_plants(raw_eia_all_plants_df):
    logger.info('Eliminating retired plants')
    retired_df = (
        pd.read_excel(
            ei_mcoe.INPUTS_DIR / 'february_generator2020.xlsx',
            'Retired', header=1,
            dtype={'Generator ID': 'str',
                   'Plant ID': 'Int64',
                   'Retirement Year': 'Int64'})
        .rename(columns={'Plant ID': 'plant_id_eia',
                         'Generator ID': 'generator_id',
                         'Retirement Year': 'retirement_year'}))
    retired_df = retired_df[['plant_id_eia', 'generator_id',
                             'retirement_year']]
    raw_with_retired_df = (
        pd.merge(raw_eia_all_plants_df, retired_df,
                 on=['plant_id_eia', 'generator_id'], how='left'))
    raw_no_retired_df = (
        raw_with_retired_df.loc[raw_with_retired_df['retirement_year'].isna()]
        .drop('retirement_year', axis=1))
    return raw_no_retired_df
def eliminate_retired_plants ( raw_eia_all_plants_df ) : logger . info ( 'Eliminating retired plants' ) retired_df = ( pd . read_excel ( ei_mcoe . INPUTS_DIR / 'february_generator2020.xlsx' , 'Retired' , header = 1 , dtype = { 'Generator ID' : 'str' , 'Plant ID' : 'Int64' , 'Retirement Year' : 'Int64' } ) . rename ( columns = { 'Plant ID' : 'plant_id_eia' , 'Generator ID' : 'generator_id' , 'Retirement Year' : 'retirement_year' } ) ) retired_df = retired_df [ [ 'plant_id_eia' , 'generator_id' , 'retirement_year' ] ] raw_with_retired_df = ( pd . merge ( raw_eia_all_plants_df , retired_df , on = [ 'plant_id_eia' , 'generator_id' ] , how = 'left' ) ) raw_no_retired_df = ( raw_with_retired_df . loc [ raw_with_retired_df [ 'retirement_year' ] . isna ( ) ] . drop ( 'retirement_year' , axis = 1 ) ) return raw_no_retired_df
Eliminate plants with retirement dates.
Eliminate plants with retirement dates .
"""Eliminate plants with retirement dates.

    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.
    Returns:
        pandas.DataFrame: A DataFrame containing raw EIA data without plants
            that have been retired.

    """ # Read recent EIA file containing retirement info # Keep relevant columns # Merge raw EIA data with retired generators data and delete those with # retirement dates
A DataFrame containing raw EIA data without plants
that have been retired.
A DataFrame containing raw EIA data without plants that have been retired .
pandas.DataFrame
raw_eia_all_plants_df
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 .