Skip to content

Commit

Permalink
Update types2publisherlocations.py for newer pandas (on_bad_lines)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickynicolson authored Aug 3, 2023
1 parent 63b48de commit f77551f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions types2publisherlocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def main():
print('Read {} GBIF lines from: {}'.format(len(df), args.inputfile_gbif))

# 1.2 Read IH data file ===========================================================
df_ih = pd.read_csv(args.inputfile_ih, sep=args.delimiter_ih, nrows=args.limit,error_bad_lines=False)
df_ih = pd.read_csv(args.inputfile_ih, sep=args.delimiter_ih, nrows=args.limit,on_bad_lines='warn')
print('Read {} IH lines from: {}'.format(len(df_ih), args.inputfile_ih))

# 1.3 Read geonames data file ===========================================================
df_gn = pd.read_csv(args.inputfile_geonames, sep=args.delimiter_geonames, nrows=args.limit,error_bad_lines=False, names=GEONAMES_COLUMNS)
df_gn = pd.read_csv(args.inputfile_geonames, sep=args.delimiter_geonames, nrows=args.limit,on_bad_lines='warn', names=GEONAMES_COLUMNS)
print('Read {} geonames lines from: {}'.format(len(df_gn), args.inputfile_geonames))
df_gn.drop(df_gn[df_gn['feature code']!='PPLC'].index,inplace=True)
print('Retained {} geonames capital city lines'.format(len(df_gn)))
Expand Down Expand Up @@ -115,4 +115,4 @@ def mapLocation(df, local_column, df_lookup, lookup_column, lat_column='latitude
return df

if __name__ == '__main__':
main()
main()

0 comments on commit f77551f

Please sign in to comment.