ows-master/examen grote lokalen/main.py

18 lines
841 B
Python
Raw Normal View History

2024-11-18 10:59:21 +00:00
import pandas as pd
file_path = 'file.xlsx'
sheet_name = 'ps (32)'
df = pd.read_excel(file_path, sheet_name=sheet_name)
filtered_df = df[df['Examenvorm'] == 'Schriftelijk' ]
filtered_df = filtered_df[filtered_df['Aant. inschr.'] > 65]
filtered_df = filtered_df[['Datum S+','Beginuur S+','Einduur S+', 'Studiegidsnr.', 'Omschrijving', 'Docenten', 'Aant. inschr.']]
#formatting the timestrings
filtered_df['Beginuur S+'] = filtered_df['Beginuur S+'].apply(lambda x: x.strftime('%H:%M'))
filtered_df['Einduur S+'] = filtered_df['Einduur S+'].apply(lambda x: x.strftime('%H:%M'))
filtered_df['Docenten'] = filtered_df['Docenten'].str.replace(r'\b(Titularis|Co-Titularis|Medewerker)\b', '',
regex=True).str.strip()
filtered_df.to_excel('filtered_grote_lokalen.xlsx', index=False)