You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
524 B
Python
19 lines
524 B
Python
import os
|
|
import re
|
|
import yaml
|
|
import pandas as pd
|
|
from glob import glob
|
|
|
|
excel_names = glob('*.xlsx')
|
|
|
|
for excel_name in excel_names:
|
|
print('processing {}'.format(excel_name))
|
|
df = pd.read_excel(excel_name)
|
|
survey_id, _ = os.path.splitext(excel_name)
|
|
|
|
for i, row in df.iterrows():
|
|
beach = row['BEACH'].replace('_', '-').lower()
|
|
yaml_name = '{}-{}.yaml'.format(survey_id, beach)
|
|
with open(yaml_name, 'w') as f:
|
|
f.write(yaml.dump(row.to_dict(), default_flow_style=False))
|