<jupyter_start><jupyter_text>Methane Emissions by SectorSource: https://cfpub.epa.gov/ghgdata/inventoryexplorer/iallsectors/allsectors/methane/inventsect/all"Where does methane come from"<jupyter_code>df = pd.read_csv("../data/epa_methane_by_sector.csv")

# convert wide to long
df = pd.melt(df, id_vars=["Emissions of Methane, MMT CO2 eq."], var_name="Year", value_name="mmt_co2_eq")
df.rename(columns={"Year": "year", "Emissions of Methane, MMT CO2 eq.": "sector"}, inplace=True)

engine = create_engine(os.getenv("PG_STRING"))

with engine.connect() as conn:
    df.to_sql(
    "epa_methane_sources",
    conn,
    schema=f'{os.getenv("BITIO_USER")}/{BITIO_REPO}',
    index=False,
    if_exists="replace")<jupyter_output><empty_output><jupyter_text>Emissions by Gas<jupyter_code>df = pd.read_csv("../data/epa_emissions_by_gas.csv")
df
df = pd.read_csv("../data/epa_emissions_by_gas.csv")
# convert wide to long
df = pd.melt(df, id_vars=["Emissions by Gas, MMT CO2 eq."], var_name="Year", value_name="mmt_co2_eq")
df.rename(columns={"Year": "year", "Emissions of Methane, MMT CO2 eq.": "sector"}, inplace=True)

engine = create_engine(os.getenv("PG_STRING"))

with engine.connect() as conn:
    df.to_sql(
    "epa_emissions_by_gas",
    conn,
    schema=f'{os.getenv("BITIO_USER")}/{BITIO_REPO}',
    index=False,
    if_exists="replace")<jupyter_output><empty_output><jupyter_text>GWP of Methane"Why do we care"Source: https://www.ipcc.ch/report/ar5/wg1/<jupyter_code># get GWPs from HFC repo
engine = create_engine(os.getenv("PG_STRING"))
# SQL for querying an entire table
sql = f'''
    SELECT *
    FROM "bitdotio/hfc"."global_warming_potentials";
'''
# Return SQL query as a pandas dataframe
with engine.connect() as conn:
    # Set 1 minute statement timeout (units are milliseconds)
    conn.execute("SET statement_timeout = 60000;")
    df = pd.read_sql(sql, conn)

    df.to_sql(
    "ipcc_global_warming_potentials",
    conn,
    schema=f'{os.getenv("BITIO_USER")}/{BITIO_REPO}',
    index=False,
    if_exists="replace")<jupyter_output><empty_output><jupyter_text>International Comparison<jupyter_code>unfccc_inventory = pd.read_csv("../data/processed_comparison.csv")
engine = create_engine(os.getenv("PG_STRING"))

with engine.connect() as conn:
    unfccc_inventory.to_sql(
    "unfccc_inventory",
    conn,
    schema=f'{os.getenv("BITIO_USER")}/{BITIO_REPO}',
    index=False,
    if_exists="replace")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15246636771300448, 'fraction_numerical': 0.005707297187117815, 'mean_word_length': 5.544, 'pattern_counts': {'":': 4, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, '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}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '467250', 'license': 'MIT', 'n_tokens_mistral': 966, 'n_tokens_neox': 939, 'n_words': 157, 'path': 'notebooks/methane_data.ipynb', 'repo_name': 'dliden-bitdotio/cop_methane', 'size': '2453'}