Skip to content

Commit

Permalink
adding CTFipsQuery class and simmilarity demo for that class
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklewa committed Jul 26, 2024
1 parent 75452f3 commit d937d2a
Show file tree
Hide file tree
Showing 2 changed files with 31,504 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cities/queries/fips_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,27 +862,28 @@ def __init__(
self.fips = fips
self.lag = lag
self.top = top
self.gdp_var = "gdp_ma"
self.population_var = "population" # default valuable
# population instead of gdp

# it's fine if they're None (by default)
self.outcome_var = outcome_var
self.outcome_comparison_period = outcome_comparison_period

self.time_decay = time_decay

if self.gdp_var not in self.feature_groups:
self.all_features = [self.gdp_var] + feature_groups
if self.population_var not in self.feature_groups:
self.all_features = [self.population_var] + feature_groups
else:
self.all_features = feature_groups

self.data.get_features_std_wide(self.all_features)
self.data.get_features_wide(self.all_features)

assert (
fips in self.data.std_wide[self.gdp_var]["GeoFIPS"].values
fips in self.data.std_wide[self.population_var]["GeoFIPS"].values
), "FIPS not found in the data set."
self.name = self.data.std_wide[self.gdp_var]["GeoName"][
self.data.std_wide[self.gdp_var]["GeoFIPS"] == self.fips
self.name = self.data.std_wide[self.population_var]["GeoName"][
self.data.std_wide[self.population_var]["GeoFIPS"] == self.fips
].values[0]

assert (
Expand Down
Loading

0 comments on commit d937d2a

Please sign in to comment.