Fix crosstable for electrification in Benin
This commit is contained in:
parent
2aa11bc793
commit
ef28259473
1 changed files with 6 additions and 2 deletions
|
@ -210,8 +210,12 @@ totals = df.loc[
|
||||||
electricityaid = totals[totals['DONOR'] < 20000] # drop all 'total' aggregations
|
electricityaid = totals[totals['DONOR'] < 20000] # drop all 'total' aggregations
|
||||||
|
|
||||||
el_grouped = electricityaid.groupby(['Year', 'Flow']).agg({'Value': ['sum']})
|
el_grouped = electricityaid.groupby(['Year', 'Flow']).agg({'Value': ['sum']})
|
||||||
el_grouped.style.format(escape="latex")
|
el_grouped = el_grouped.reset_index(['Year', 'Flow'])
|
||||||
el_grouped
|
el_grouped.columns = el_grouped.columns.to_flat_index()
|
||||||
|
el_grouped.columns = ['Year', 'Flow', 'Value']
|
||||||
|
|
||||||
|
crosstab = pd.crosstab(el_grouped['Year'], el_grouped['Flow'], margins=True, values=el_grouped['Value'], aggfunc='sum')
|
||||||
|
Markdown(tabulate(crosstab.fillna("0.00"), headers="keys", tablefmt="github", floatfmt=".2f"))
|
||||||
```
|
```
|
||||||
|
|
||||||
::: {custom-style="caption"}
|
::: {custom-style="caption"}
|
||||||
|
|
Loading…
Reference in a new issue