klassen in File speichern

Übersicht in Excel
This commit is contained in:
Patrick vom Hagen
2024-08-02 15:08:04 +02:00
parent 936a00c81f
commit 3e36a1513e
3 changed files with 22 additions and 42 deletions

12
main.py
View File

@@ -34,6 +34,7 @@ ox_quota_sus = 5120 # oxUserQuota LuL
#######################
# MAIN FUNCTION START #
# .venv\Scripts\activate
if __name__ == "__main__":
@@ -89,10 +90,17 @@ if __name__ == "__main__":
# ---------------------------------------------------- #
# Step 2 - auf name, vorname reduzieren und abgleichen #
# Klassen Übersicht leeren
with open('./output/klassen.txt', 'w') as file:
file.write('')
lul_exel_path = 'output/stats_lul.xlsx'
sus_exel_path = 'output/stats_sus.xlsx'
print("\n Lehrer:innen:")
lul_matched, new_lul = step2.compare_data(lul_new, lul_sys, len(lul_testuser_df))
lul_matched, new_lul = step2.compare_data(lul_new, lul_sys, len(lul_testuser_df), lul_exel_path)
print("\n Schüler:innen:")
sus_matched, new_sus = step2.compare_data(sus_new, sus_sys, len(sus_testuser_df))
sus_matched, new_sus = step2.compare_data(sus_new, sus_sys, len(sus_testuser_df), sus_exel_path)
# ----------------------------------------------------------------------------------------#
# Step 3 - Import Data generieren - klasse, uuids, weiteres in einer Liste zusammenführen #

View File

@@ -12,24 +12,6 @@ Anzahl Test- / Systemuser SuS: 1
Eintr<EFBFBD>ge in System Liste: 101
Eintr<EFBFBD>ge in Import Liste: 89
['L_L' nan '9c-24' '5e-24' '9d-24' 'Ec-24' 'Ef-24' 'Eg-24' '6c-24' '6a-24'
'7d-24' 'Q2f-24' '10b-24' '8b-24' '7a-24' 'Q2b-24' '7b-24' '8a-24'
'9e-24' 'Ed-24' '10d-24' '9b-24' 'SB' '6b-24' 'Q2c-24' '8c-24' '5b-24'
'5c-24' '10a-24' '9a-24' 'Q2e-23' '10c-24' '6d-24' '7c-24' '8d-24'
'Eb-24' 'Ee-24' 'Q2d-24' 'Q2a-24' '5d-24' '5a-24' 'Q2g-24' 'Q1a-24'
'Ea-24' 'Sek' '8e-23']
['HL0705102-L_L' 'HL0705102-6d-23' 'HL0705102-Q2e-23' 'HL0705102-5c-23'
'HL0705102-5a-23' 'HL0705102-10e-23' 'HL0705102-8b-23' 'HL0705102-Q1f-23'
'HL0705102-9b-23' 'HL0705102-7b-23' 'HL0705102-8a-23' 'HL0705102-9d-23'
'HL0705102-Q2a-23' 'HL0705102-10a-23' 'HL0705102-Q1c-23'
'HL0705102-8e-23' 'HL0705102-6a-23' 'HL0705102-Q2d-23' 'HL0705102-DaZ-23'
'HL0705102-Q1a-23' 'HL0705102-Q1g-23' 'HL0705102-Q2b-23'
'HL0705102-7c-23' 'HL0705102-10b-23' 'HL0705102-9a-23' 'HL0705102-10d-23'
'HL0705102-Ea-23' 'HL0705102-Q2c-23' 'HL0705102-5b-23' 'HL0705102-8d-23'
'HL0705102-9c-23' 'HL0705102-Q1e-23' 'HL0705102-7a-23' 'HL0705102-6b-23'
'HL0705102-6c-23' 'HL0705102-8c-23' 'HL0705102-Q1b-23' 'HL0705102-5d-23'
'HL0705102-10c-23' 'HL0705102-7d-23' 'HL0705102-Sek' 'HL0705102-Q1d-23'
nan 'HL0705102-testgruppe' 'HL0705102-Dummy']
Anzahl neuer Nutzer: 4
Anzahl <20>bereinstimmungen: 87
@@ -42,24 +24,6 @@ M
Eintr<EFBFBD>ge in System Liste: 973
Eintr<EFBFBD>ge in Import Liste: 1011
['Q2f-24' '10a-24' 'Ef-24' '10b-24' '10c-24' '10d-24' '5a-24' '5b-24'
'5c-24' '5d-24' '5E-24' '6a-24' '6b-24' '6c-24' '6d-24' '7a-24' '7b-24'
'7c-24' '7d-24' '8a-24' '8b-24' '8c-24' '8d-24' '9a-24' '9b-24' '9c-24'
'9d-24' '9E-24' 'Ea-24' 'Eb-24' 'Ec-24' 'Ed-24' 'Ee-24' 'Eg-24' 'Q1a-24'
'Q2a-24' 'Q2b-24' 'Q2c-24' 'Q2d-24' 'Q2e-24' 'Q2g-24' nan]
['HL0705102-10b-23' 'HL0705102-10e-23' 'HL0705102-10a-23'
'HL0705102-10c-23' 'HL0705102-10d-23' 'HL0705102-9a-23'
'HL0705102-Q1b-23' 'HL0705102-Q1a-23' 'HL0705102-Q1d-23'
'HL0705102-Q1f-23' 'HL0705102-Q1g-23' 'HL0705102-Q1c-23'
'HL0705102-Ea-23' 'HL0705102-Q1e-23' 'HL0705102-Q2d-23'
'HL0705102-Q2a-23' 'HL0705102-Q2c-23' 'HL0705102-Q2b-23'
'HL0705102-Q2e-23' 'HL0705102-9d-23' 'HL0705102-9b-23' 'HL0705102-9c-23'
'HL0705102-8a-23' 'HL0705102-8b-23' 'HL0705102-Dummy' 'HL0705102-8c-23'
'HL0705102-8e-23' 'HL0705102-8d-23' 'HL0705102-7c-23' 'HL0705102-7b-23'
'HL0705102-7d-23' 'HL0705102-7a-23' 'HL0705102-Ed-22' 'HL0705102-DaZ-23'
'HL0705102-6a-23' 'HL0705102-6b-23' 'HL0705102-6c-23' 'HL0705102-6d-23'
'HL0705102-Q2c-22' 'HL0705102-5d-23' 'HL0705102-5c-23' 'HL0705102-5b-23'
'HL0705102-5a-23' 'HL0705102-testgruppe']
Anzahl neuer Nutzer: 168
Anzahl <20>bereinstimmungen: 844

View File

@@ -1,8 +1,9 @@
import numpy as np
import pandas as pd
from Levenshtein import distance
def compare_data(new, sys, count_test):
def compare_data(new, sys, count_test, path):
print(f"\nEinträge in System Liste: {len(sys)}")
print(f"Einträge in Import Liste: {len(new)}")
@@ -25,7 +26,7 @@ def compare_data(new, sys, count_test):
only_new = merged_df[merged_df['_merge'] == 'left_only'].drop(columns=['_merge'])
only_sys = merged_df[merged_df['_merge'] == 'right_only'].drop(columns=['_merge'])
print_status(matches, only_new, only_sys, count_test)
print_status(matches, only_new, only_sys, count_test, path)
search_typos(only_new[['name', 'vorname']], only_sys[['name', 'vorname']])
return matches, only_new
@@ -50,10 +51,17 @@ def unique_classes(df):
df['klasse'] = df['klasse'].str.split(',')
df = df.explode('klasse')
eindeutige_klassen = df['klasse'].unique()
print(eindeutige_klassen)
with open('./output/klassen.txt', 'a') as file:
file.write(np.array_str(eindeutige_klassen))
# print(eindeutige_klassen)
def print_status(matches, new, old, count_test):
def print_status(matches, new, old, count_test, path):
print("\nAnzahl neuer Nutzer:", len(new))
print("Anzahl Übereinstimmungen:", len(matches) + count_test)
print("Anzahl veralteter Nutzer:", len(old) - count_test)
with pd.ExcelWriter(path, engine='openpyxl') as writer:
matches.to_excel(writer, sheet_name='Matches', index=False)
new.to_excel(writer, sheet_name='Neu', index=False)
old.to_excel(writer, sheet_name='Alt', index=False)