Skip to content

Commit

Permalink
fixed broken csv parsing for 2014 due to emptry strings
Browse files Browse the repository at this point in the history
  • Loading branch information
sehoffmann committed Aug 24, 2023
1 parent 864fe68 commit 5f02d02
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions folktables/load_acs.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ def load_acs(root_dir, states=None, year=2018, horizon='1-Year',
initialize_and_download(base_datadir, state, year, horizon, survey, download=download)
)

dtypes = {'PINCP': np.float64, 'RT': str, 'SOCP': str, 'SERIALNO': str, 'NAICSP': str}
df_list = []
for file_name in file_names:
df = pd.read_csv(file_name, dtype=dtypes).replace(' ','')
dtype = {'RT': str, 'SOCP': str, 'SERIALNO': str, 'NAICSP': str}
df = pd.read_csv(file_name, na_values=[' '], dtype=dtype).replace(' ','')
#df['PINCP'] = pd.to_numeric(df['PINCP'], errors='coerce').astype(float)

if serial_filter_list is not None:
df = df[df['SERIALNO'].isin(serial_filter_list)]
df_list.append(df)
Expand Down

0 comments on commit 5f02d02

Please sign in to comment.