kills_summary_annual = strikes_df
.groupby("year")
.rollup({
min_civilian_deaths: d => op.sum(d["Minimum civilians reported killed"]),
max_civilian_deaths: d => op.sum(d["Maximum civilians reported killed"]),
min_deaths: d => op.sum(d["Minimum total people killed"]),
max_deaths: d => op.sum(d["Maximum total people killed"])
})
.ungroup()
.derive({
avg_civilian_deaths: d => (d.max_civilian_deaths + d.min_civilian_deaths) / 2,
avg_total_deaths: d => (d.max_deaths + d.min_deaths)/ 2
})
.derive({est_combatant_deaths: d => d.avg_total_deaths - d.avg_civilian_deaths})
.derive({combatant_kills_per_civilian: d => d.est_combatant_deaths / d.avg_civilian_deaths})
.orderby("year")