src/ei_mcoe/ei_mcoe.py
def pull_fred_inflation_df():
    """Read FRED inflation data from API."""
    fred_api = Fred(api_key=os.environ.get('API_KEY_FRED'))
    data = fred_api.get_series('CUUR0000SAH2')
    df = pd.DataFrame(data).reset_index()
    df.columns = ['date', 'value']
    df['year'] = df['date'].apply(lambda x: x.year)
    df['month'] = df['date'].apply(lambda x: x.month)
    df = df.loc[df['month'] == 1]
    return df
Read FRED inflation data from API.
Read FRED inflation data from API.
Read FRED inflation data from API .
def pull_fred_inflation_df():
    fred_api = Fred(api_key=os.environ.get('API_KEY_FRED'))
    data = fred_api.get_series('CUUR0000SAH2')
    df = pd.DataFrame(data).reset_index()
    df.columns = ['date', 'value']
    df['year'] = df['date'].apply(lambda x: x.year)
    df['month'] = df['date'].apply(lambda x: x.month)
    df = df.loc[df['month'] == 1]
    return df
def pull_fred_inflation_df ( ) : fred_api = Fred ( api_key = os . environ . get ( 'API_KEY_FRED' ) ) data = fred_api . get_series ( 'CUUR0000SAH2' ) df = pd . DataFrame ( data ) . reset_index ( ) df . columns = [ 'date' , 'value' ] df [ 'year' ] = df [ 'date' ] . apply ( lambda x : x . year ) df [ 'month' ] = df [ 'date' ] . apply ( lambda x : x . month ) df = df . loc [ df [ 'month' ] == 1 ] return df
Read FRED inflation data from API.
Read FRED inflation data from API .
"""Read FRED inflation data from API."""