forked from Stance4Health-Dev/Recipr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spanish_database.py
30 lines (20 loc) · 873 Bytes
/
spanish_database.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import pyexcel as pe
from correspondences import get_correspondences
# ------------------------------------------------------------------------------
def process_spanish_db(fields_correspondences,filename = "data/espanola.xlsx"):
## Read the sheet (we need to specify the correct sheet of the book)
sheet = pe.get_sheet(file_name=filename)
# Get field names
row_names = sheet.row[0]
# print(row_names)
n_fields = len(row_names)
for i in range(n_fields):
row_names[i] = fields_correspondences[row_names[i]]
# Save all the changes
sheet.row[0] = row_names
sheet.save_as("data/processed-spanish-db.xlsx")
pass
# ------------------------------------------------------------------------------
if __name__ == "__main__":
fields_correspondences = get_correspondences()
process_greek_db(fields_correspondences)