File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ def run_module(params):
104
104
"state_code" ,
105
105
from_col = "state" )
106
106
if sensor == POP_PROP :
107
- df = pop_proportion (df )
107
+ df = pop_proportion (df , geo_mapper )
108
108
df = make_geo (df , geo , geo_mapper )
109
109
df = smooth_values (df , smoother [0 ])
110
110
if df .empty :
@@ -140,9 +140,8 @@ def smooth_values(df, smoother):
140
140
)
141
141
return df
142
142
143
- def pop_proportion (df ):
143
+ def pop_proportion (df , geo_mapper ):
144
144
"""Get the population-proportionate variants as the dataframe val."""
145
- geo_mapper = GeoMapper ()
146
145
pop_val = geo_mapper .add_population_column (df , "state_code" )
147
146
df ["val" ]= df ["val" ]/ pop_val ["population" ]* 100000
148
147
pop_val .drop ("population" , axis = 1 , inplace = True )
Original file line number Diff line number Diff line change @@ -79,13 +79,14 @@ def test_make_signal():
79
79
make_signal (data , "zig" )
80
80
81
81
def test_pop_proportion ():
82
+ geo_mapper = GeoMapper ()
82
83
test_df = pd .DataFrame ({
83
84
'state' : ['PA' ],
84
85
'state_code' :[42 ],
85
86
'timestamp' : [datetime (year = 2020 , month = 1 , day = 1 )],
86
87
'val' : [15. ],})
87
88
pd .testing .assert_frame_equal (
88
- pop_proportion (test_df ),
89
+ pop_proportion (test_df , geo_mapper ),
89
90
pd .DataFrame ({
90
91
'state' : ['PA' ],
91
92
'state_code' :[42 ],
You can’t perform that action at this time.
0 commit comments