Skip to content

Commit 4205340

Browse files
committed
Update to new enum codes, fix tests
1 parent 44d24d3 commit 4205340

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

safegraph/delphi_safegraph/process.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
add_prefix,
1111
create_export_csv,
1212
GeoMapper,
13-
NAN_CODES,
13+
Nans,
1414
)
1515

1616
from .constants import HOME_DWELL, COMPLETELY_HOME, FULL_TIME_WORK, PART_TIME_WORK, GEO_RESOLUTIONS
@@ -220,19 +220,19 @@ def process_window(df_list: List[pd.DataFrame],
220220
df_export["timestamp"] = date.strftime('%Y%m%d')
221221

222222
# Default missingness codes
223-
df_export["missing_val"] = NAN_CODES["Not Missing"]
224-
df_export["missing_se"] = NAN_CODES["Not Missing"]
223+
df_export["missing_val"] = Nans.NOT_MISSING
224+
df_export["missing_se"] = Nans.NOT_MISSING
225225
# Sample size will never be missing in this indicator
226226
# since sample_size just counts the presence of rows for a geo region
227-
df_export["missing_sample_size"] = NAN_CODES["Not Missing"]
227+
df_export["missing_sample_size"] = Nans.NOT_MISSING
228228
# Add missingness codes as detected
229229
# This may occur if all the values are missing for a geographic region
230230
remaining_nans_mask = df_export["val"].isnull()
231-
df_export.loc[remaining_nans_mask, "missing_val"] = NAN_CODES["Unknown"]
231+
df_export.loc[remaining_nans_mask, "missing_val"] = Nans.UNKNOWN
232232
# This may occur if all the values are missing for a geographic region
233233
# or if the sample size is 1
234234
remaining_nans_mask = df_export["se"].isnull()
235-
df_export.loc[remaining_nans_mask, "missing_se"] = NAN_CODES["Data Insufficient"]
235+
df_export.loc[remaining_nans_mask, "missing_se"] = Nans.DATA_INSUFFICIENT
236236

237237
create_export_csv(df_export,
238238
export_dir,

0 commit comments

Comments
 (0)