ows-master/random/bascriptiegroepennaarexamengroepen.py

32 lines
1.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import pandas as pd
def assign_exam_group(value):
mapping = {
"Hoofd versus hand: de waardering van ambacht en ambachtelijkheid herbekeken, 1500-2024": 6,
"De wereld van een koopman in de briefwisseling van Henri-François Schilders, tweede helft zeventiende eeuw": 1,
"Hoe overleef ik een revolutie? Huishoudens en hun overlevingsstrategieën in een tijd van polarisatie en verandering (1750-1850)": 5,
"Komt dat zien! Het theatrale uitgaansleven in België in de negentiende en vroege twintigste eeuw (1830-1930)": 4 ,
"Erfenisaangiften als venster op de Antwerpse samenleving, 1835 1912": 3,
"Sporen van gulden en franken. De geldzaken van huishoudens in de twintigste eeuw": 2,
# Add more mappings as needed
}
return mapping.get(value, 0) # Default to 0 if no match
def process_excel(file_path):
df = pd.read_excel(file_path, sheet_name="Sheet1")
if 'Groep' not in df.columns:
raise ValueError("Column 'Groep' not found in the Excel file.")
df['Examengroep'] = df['Groep'].apply(assign_exam_group)
output_file = "processed_" + file_path
df.to_excel(output_file, index=False)
print(f"Processed file saved as {output_file}")
if __name__ == "__main__":
process_excel("bascriptie groepen.xlsx")