Merge pull request #973 from koen-vg/fill-missing-domestic-aviation
Fill in missing eurostat data on domestic aviation energy demand
This commit is contained in:
commit
91c9dd2b82
@ -124,6 +124,17 @@ def build_eurostat(input_eurostat, countries, nprocesses=1, disable_progressbar=
|
|||||||
)
|
)
|
||||||
df = pd.concat([temp, df.loc[~int_avia]])
|
df = pd.concat([temp, df.loc[~int_avia]])
|
||||||
|
|
||||||
|
# Fill in missing data on "Domestic aviation" for each country.
|
||||||
|
domestic_avia = df.index.get_level_values(4) == "Domestic aviation"
|
||||||
|
for country in countries:
|
||||||
|
slicer = idx[country, :, :, :, "Domestic aviation"]
|
||||||
|
# For the Total and Fossil energy columns, fill in zeros with
|
||||||
|
# the closest non-zero value in the year index.
|
||||||
|
for col in ["Total", "Fossil energy"]:
|
||||||
|
df.loc[slicer, col] = (
|
||||||
|
df.loc[slicer, col].replace(0.0, np.nan).ffill().bfill()
|
||||||
|
)
|
||||||
|
|
||||||
# Renaming some indices
|
# Renaming some indices
|
||||||
index_rename = {
|
index_rename = {
|
||||||
"Households": "Residential",
|
"Households": "Residential",
|
||||||
|
Loading…
Reference in New Issue
Block a user