40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
import pandas as pd
|
|
|
|
# Baca CSV 2024
|
|
df = pd.read_csv('Data_2024_Tracer_study.csv', sep=';', encoding='utf-8-sig')
|
|
source_cols = list(df.columns)
|
|
|
|
print("=== HEADER CSV 2024 ===")
|
|
print(f"Total kolom: {len(source_cols)}")
|
|
print()
|
|
|
|
# Cari kolom NIM
|
|
nim_candidates = [c for c in source_cols if 'nim' in c.lower() or 'nmmhs' in c.lower()]
|
|
print(f"Kolom NIM candidates: {nim_candidates}")
|
|
|
|
# Normalize function dari import_data.py
|
|
def normalize(col_name):
|
|
if pd.isna(col_name):
|
|
return ""
|
|
return str(col_name).strip().lower()
|
|
|
|
# Check find_column
|
|
source_cols_lower = {normalize(c): c for c in source_cols}
|
|
print()
|
|
print("=== TEST find_column ===")
|
|
test_names = [
|
|
'nimhsmsmh', 'NIM/Nomor Mahasiswa', 'NIM',
|
|
'3. NIM / nimhsmsmh', '3. NIM / nimhsmsmh (Gunakan Huruf Besar)',
|
|
]
|
|
|
|
for name in test_names:
|
|
normalized = normalize(name)
|
|
if normalized in source_cols_lower:
|
|
print(f"FOUND: '{name}' -> '{source_cols_lower[normalized]}'")
|
|
else:
|
|
print(f"NOT FOUND: '{name}' (normalized: '{normalized}')")
|
|
# Suggest similar
|
|
for k in source_cols_lower.keys():
|
|
if 'nim' in k or 'nmmhs' in k:
|
|
print(f" Similar in CSV: '{k}' -> '{source_cols_lower[k]}'")
|