Skip to content

Commit

Permalink
update excepted rows for no-fips id-ed respondents but keep annualize…
Browse files Browse the repository at this point in the history
…d demand
  • Loading branch information
cmgosnell committed Nov 7, 2023
1 parent f251def commit e4c1c46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/pudl/output/ferc714.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,18 +652,20 @@ def summarized_demand_ferc714(
demand_hourly_pa_ferc714.loc[
:, ["report_date", "respondent_id_ferc714", "demand_mwh"]
],
on=["report_date", "respondent_id_ferc714"],
how="left",
)
.groupby(["report_date", "respondent_id_ferc714"])
.agg({"demand_mwh": sum})
.groupby(["report_date", "respondent_id_ferc714"], as_index=False)[
["demand_mwh"]
]
.sum(min_count=1)
.rename(columns={"demand_mwh": "demand_annual_mwh"})
.reset_index()
.merge(
georeferenced_counties_ferc714.groupby(
["report_date", "respondent_id_ferc714"]
)
.agg({"population": sum, "area_km2": sum})
.reset_index()
["report_date", "respondent_id_ferc714"], as_index=False
)[["population", "area_km2"]].sum(min_count=1),
on=["report_date", "respondent_id_ferc714"],
how="left",
)
.assign(
population_density_km2=lambda x: x.population / x.area_km2,
Expand Down
2 changes: 1 addition & 1 deletion test/validate/service_territory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"df_name,expected_rows",
[
("summarized_demand_ferc714", 3_195),
("fipsified_respondents_ferc714", 135_627),
("fipsified_respondents_ferc714", 135_537),
("compiled_geometry_balancing_authority_eia861", 112_507),
("compiled_geometry_utility_eia861", 247_705),
],
Expand Down

0 comments on commit e4c1c46

Please sign in to comment.