<commit_before>import pandas as pd
from src.util.utils import getParentDir
from os.path import join, abspath, normpath, dirname, split

def annual(df, state, region_col='NERC'):
    """Return the percent of gen & consumption by fuel type in each region
    for a state

    inputs:
        df (dataframe): a dataframe with data from the most recent EIA-923
            final release. It should either contain a column with reporting
            frequency ('A' or 'M' for annual/monthly), or only include annual
            facilities.

    What if I want to do something other than NERC regions? What is the
    appropriate column name?

    What sort of data is this function supposed to accept?
    - State of each facility
    - Reporting frequency
    - Year
    - NERC region (or other region code?)
    - plant id
    - fuel category
    - generation, total fuel, elec fuel

    output:
        result (df): The percent of generation, toal fuel, and electric fuel
            from annual reporting facilities in each (NERC) region from each
            state

    """
    # Not sure if I'll pass through all facilities or just annual.
    # Drop monthly if all facilities are passed through
    if 'reporting frequency' in df.columns:
        a = df.loc[(df.state == state) &
                         (df['reporting frequency'] == 'A')].copy()
    else:<commit_msg>Rename function. It will only do calculations for a single state<commit_after>import pandas as pd
from src.util.utils import getParentDir
from os.path import join, abspath, normpath, dirname, split

def fraction_state2nerc(df, state, region_col='NERC'):
    """Return the percent of gen & consumption by fuel type in each region
    for a state

    inputs:
        df (dataframe): a dataframe with data from the most recent EIA-923
            final release. It should either contain a column with reporting
            frequency ('A' or 'M' for annual/monthly), or only include annual
            facilities.

    What if I want to do something other than NERC regions? What is the
    appropriate column name?

    What sort of data is this function supposed to accept?
    - State of each facility
    - Reporting frequency
    - Year
    - NERC region (or other region code?)
    - plant id
    - fuel category
    - generation, total fuel, elec fuel

    output:
        result (df): The percent of generation, toal fuel, and electric fuel
            from annual reporting facilities in each (NERC) region from the
            state

    """
    # Not sure if I'll pass through all facilities or just annual.
    # Drop monthly if all facilities are passed through
    if 'reporting frequency' in df.columns:
        a = df.loc[(df.state == state) &
                         (df['reporting frequency'] == 'A')].copy()
    else:
{'fraction_non_alphanumeric': 0.0680926916221034, 'fraction_numerical': 0.0024955436720142605, 'mean_word_length': 2.4987531172069826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7289849', 'n_tokens_mistral': 732, 'n_tokens_neox': 705, 'n_words': 351}