Skip to content

Instantly share code, notes, and snippets.

@chhantyal
Created August 8, 2013 12:57
Show Gist options
  • Save chhantyal/6184344 to your computer and use it in GitHub Desktop.
Save chhantyal/6184344 to your computer and use it in GitHub Desktop.
def change_keys(row_dict):
"""
It returns a dictionary with keys in English and all lowercase.
Create a dictionary to map keys to given dictionary keys.
Following is Dutch to English text mapping.
"""
dict_map = {
'Leerlingnummer': 'student_id',
'Voornamen': 'first_name',
'Achternaam': 'last_name',
'Groepsnaam huidige groepsindeling': 'class_id',
'Email adres ouder woonadres': 'parents_email',
'address': 'address',
'Telefoonnummer': 'phone',
'Mobielnummer ouder woonadres' : 'mobile'
}
final_row = {dict_map[k]: v for k, v in row_dict.items()}
return final_row
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment