<jupyter_start><jupyter_text>[Inhaltsverzeichnis](../AP4.ipynb) | [  next](wohin?) 4.1.4 Stündliche Primär-Energie und Treibhausgas-Emissionen<jupyter_code># OPTIONAL: Load the "autoreload" extension so that code can change
%load_ext autoreload
# OPTIONAL: always reload modules so that as you change code in src, it gets loaded
%autoreload 2
%matplotlib inline
from FLUCCOplus.notebooks import *
import FLUCCOplus.electricitymap as elmap
import FLUCCOplus.conversion_factors as conversion
em = elmap.fetch_common().rename(columns={a: b for a, b in zip(elmap.pcs, elmap.SOURCES)}, inplace=False)[elmap.SOURCES]
em

# map([print(i) for i in conversion.CONVERSION_FACTORS.keys()])
conversion.conversion_mapping
conversion.conversion_columns

em = elmap.fetch_common();
em.rename(columns={a: b for a, b in zip(elmap.pcs, elmap.SOURCES)}, inplace=True);

PE = elmap.primary_energy(em[elmap.SOURCES])

PE.plot();

faktoren = conversion.CONVERSION_FACTORS

header = conversion.conversion_columns
PE_teile = header[1:4]
f = pd.DataFrame(faktoren).transpose()
f
f[PE_teile].plot(kind="barh", stacked=True);

em = elmap.fetch_common();
em.rename(columns={a: b for a, b in zip(elmap.pcs, elmap.SOURCES)}, inplace=True);

PE = elmap.primary_energy(em[elmap.SOURCES])

PE.plot();
hourly_PEfactor = PE["total_consumption_avg"] / em["total_consumption_avg"]
avg_factors = hourly_PEfactor.resample("Y").mean()
avg_factors.plot(kind="barh")
avg_factors["OIB 2018"] = 1.78
avg_factors["OIB 2019"] = 1.63
avg_factors.plot(kind="barh")
fPEs = elmap.pe_factors().drop(columns=["fPE"])
fPEs.columns
fPEs.mean()
fPEs.resample("Y").mean().plot(kind="barh", stacked="true")
avg_factors = hourly_PEfactor.resample("Y").mean()
avg_factors.plot(kind="barh")
avg_factors["OIB 2018"] = 1.78
avg_factors["OIB 2019"] = 1.63
avg_factors.plot(kind="barh")
fPEs.to_csv(DATA_INTERIM / "fPEs_15-19.csv",
          sep=";",
          decimal=",",
          encoding="cp850")
a = elmap.read_interim("fPEs_15-19.csv")
a.plot()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup