Commit 80e5bd23 authored by Simon Pintarelli's avatar Simon Pintarelli

select cols First Name, Last Name, Number in step 1, skip the rest

parent 176d2e43
......@@ -13,18 +13,27 @@ import os
selected_columns = ['Number', 'Last Name', 'First Name']
# header_de = [
# 'Id', 'Familienname', 'Vorname', 'Nummer', 'Sekretariat', 'Fachrichtung',
# 'Rep.', 'Note', '+ / - (Notentendenz)', '* (Abbruch/nicht erschienen)',
# 'Prüfsumme'
# ]
# header_en = [
# 'Id', 'Last Name', 'First Name', 'Number', 'Administration Office',
# 'Direction', 'Rep.', 'Grade', '+ / - (Grade Trend)', '* (dropout/no show)',
# 'Checksum'
# ]
# skip unneeded columns
header_de = [
'Id', 'Familienname', 'Vorname', 'Nummer', 'Sekretariat', 'Fachrichtung',
'Rep.', 'Note', '+ / - (Notentendenz)', '* (Abbruch/nicht erschienen)',
'Prüfsumme'
'Familienname', 'Vorname', 'Nummer'
]
header_en = [
'Id', 'Last Name', 'First Name', 'Number', 'Administration Office',
'Direction', 'Rep.', 'Grade', '+ / - (Grade Trend)', '* (dropout/no show)',
'Checksum'
'Last Name', 'First Name', 'Number'
]
translation = {
'Id': 'Id',
'Familienname': 'Last Name',
......@@ -53,13 +62,15 @@ def extract_columns(args):
if 'Familienname' in edoz_data.columns:
# there is a tab past there last column => pandas reads an additional empty
# column (filled with nan) get rid of this additional column
edoz_data = edoz_data[header_de]
# translate headers to EN
assert(all([(i in header_de or i in header_en) for i in edoz_data.columns]))
new_col_names = [translation[c] for c in edoz_data.columns]
edoz_data.columns = new_col_names
# edoz_data = edoz_data[header_de]
# # translate headers to EN
# assert(all([(i in header_de or i in header_en) for i in edoz_data.columns]))
# new_col_names = [translation[c] for c in edoz_data.columns]
# edoz_data.columns = new_col_names
raise Exception('Error: use the english version of edoz to export the student list, \n \
e.g. click on _English_ during login. ')
elif 'Last Name' in edoz_data:
# there is a tab past there last column => pandas reads an additional empty
# there is a tab past the last column => pandas reads an additional empty
# column (filled with nan) get rid of this additional column
edoz_data = edoz_data[header_en]
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment