Skip to content

Commit

Permalink
make county voter ID handling work with added strings for Clark count…
Browse files Browse the repository at this point in the history
…y data bugfix
  • Loading branch information
cvcotton committed Jan 22, 2024
1 parent 9adf1b1 commit 15b482c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion reggie/ingestion/preprocessor/nevada_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,17 @@ def insert_code_bin(arr):
)

# create compound string for unique voter ID from county ID
def format_county_id(vid):
try:
vid = int(float(vid))
except ValueError:
pass
return str(vid)

df_voters["County_Voter_ID"] = (
df_voters["County"].str.replace(" ", "").str.lower()
+ "_"
+ df_voters["County_Voter_ID"].astype(int).astype(str)
+ df_voters["County_Voter_ID"].map(format_county_id)
)
df_voters = self.config.coerce_dates(df_voters)
df_voters = self.config.coerce_numeric(
Expand Down

0 comments on commit 15b482c

Please sign in to comment.