Skip to content

Commit

Permalink
Error trap for '-' in FT_PCT
Browse files Browse the repository at this point in the history
  • Loading branch information
cmunch1 committed Apr 12, 2024
1 parent 7a7ea52 commit 3b9be95
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/webscraping.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,13 @@ def combine_home_visitor(df: pd.DataFrame) -> pd.DataFrame:
else:
#once, scraped data like FT_PCT was missing values (and used a dash mark as a placeholder) and caused float fields to be saved as object fields
#this is a quick fix for that particular issue.
if df[field].str.contains('.').any():
df[field] = df[field].astype('float64')
if df[field].str.contains('-').any():
df[field] = df[field].str.replace('-','0')
df[field] = df[field].astype('float64')
else:
if df[field].str.contains('-').any():
df[field] = df[field].str.replace('-','0')
df[field] = df[field].astype('float64')
else:
if df[field].str.contains('.').any():
df[field] = df[field].astype('float64')
else:
df[field] = df[field].astype('int64')


Expand Down

0 comments on commit 3b9be95

Please sign in to comment.