Skip to content

Commit

Permalink
extra columns for off
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanegigandet committed Nov 6, 2024
1 parent 8dc55c4 commit ec75d1e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/generate_dump_for_offline_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ def main():
os.makedirs(off_public_data_dir + '/offline')

df = pandas.read_csv(off_public_data_dir + '/en.' + product_opener_flavor + '.org.products.csv', sep='\t', low_memory=False)
colnames = ['code','product_name','quantity','brands','nutriscore_grade','nova_group','ecoscore_grade']
colnames = ['code','product_name','quantity','brands']
# add 'nutriscore_grade','nova_group','ecoscore_grade' columns if the flavor is off
if product_opener_flavor_short == 'off':
colnames = colnames + ['nutriscore_grade','nova_group','ecoscore_grade']

df.rename(columns={'nutriscore_grade': 'nutrition_grade_fr'}).to_csv(off_public_data_dir + '/offline/en.' + product_opener_flavor + '.org.products.small.csv', columns = colnames,sep='\t',index=False)

if __name__ == '__main__':
Expand Down

0 comments on commit ec75d1e

Please sign in to comment.