Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/fbi/hate_crime/table13/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ def _clean_dataframe(df: pd.DataFrame, year: str, table_num: str):
axis=1,
inplace=True,
errors='ignore')
df['state'] = df['state'].fillna(method='ffill')
df['agency type'] = df['agency type'].fillna(method='ffill')
df['state'] = df['state'].ffill()
df['agency type'] = df['agency type'].ffill()

# Assigning agency to state
df.loc[df['agency type'] == 'Total',
Expand Down
4 changes: 2 additions & 2 deletions scripts/fbi/hate_crime/table14/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def _clean_dataframe(df: pd.DataFrame, year: str, table_num: str):
inplace=True,
errors='ignore')

df['state'] = df['state'].fillna(method='ffill')
df['agency type'] = df['agency type'].fillna(method='ffill')
df['state'] = df['state'].ffill()
df['agency type'] = df['agency type'].ffill()

# Cleaning cities
df = df[df['agency'].notna()]
Expand Down