Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
lennybronner committed Oct 15, 2024
1 parent cd22a53 commit 8e8b87d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/elexmodel/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from collections import defaultdict
import pprint
from collections import defaultdict

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -352,7 +352,11 @@ def get_estimates(
There are {n_nonreporting_units} nonreporting units."""
)
if len(non_modeled_units) > 0:
non_modeled_units = non_modeled_units.groupby("unit_category")[["postal_code", "geographic_unit_fips"]].apply(lambda x: list(x.itertuples(index=False, name=None))).to_dict()
non_modeled_units = (
non_modeled_units.groupby("unit_category")[["postal_code", "geographic_unit_fips"]]
.apply(lambda x: list(x.itertuples(index=False, name=None)))
.to_dict()
)
non_modeled_units_pprint = pprint.pformat(non_modeled_units)
LOG.info(f"non-modeled units:\n{non_modeled_units_pprint}")

Expand Down
6 changes: 4 additions & 2 deletions src/elexmodel/handlers/data/CombinedData.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,10 @@ def _get_non_modeled_units(
].copy()
units_with_strange_margin_change["unit_category"] = "non-modeled: strange margin change"
non_modeled_units_list.append(units_with_strange_margin_change)

non_modeled_units = pd.concat(non_modeled_units_list).reset_index(drop=True).drop_duplicates(subset='geographic_unit_fips')

non_modeled_units = (
pd.concat(non_modeled_units_list).reset_index(drop=True).drop_duplicates(subset="geographic_unit_fips")
)
return non_modeled_units

def write_data(self, election_id, office):
Expand Down

0 comments on commit 8e8b87d

Please sign in to comment.