49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
import pandas as pd
|
|
|
|
# Baca semua CSV untuk cek header
|
|
files = {
|
|
'2019': r'c:\Users\syifa\TA-PROJEK\Data_Tracerstudy\Data_2019_Tracer_study.csv',
|
|
'2020': r'c:\Users\syifa\TA-PROJEK\Data_Tracerstudy\Data_2020_Tracer_study.csv',
|
|
'2021': r'c:\Users\syifa\TA-PROJEK\Data_Tracerstudy\Data_2021_Tracer_study.csv',
|
|
'2022': r'c:\Users\syifa\TA-PROJEK\Data_Tracerstudy\Data_2022_Tracer_study.csv',
|
|
}
|
|
|
|
for tahun, filepath in files.items():
|
|
try:
|
|
df = pd.read_csv(filepath, sep=';', encoding='utf-8-sig')
|
|
cols = list(df.columns)
|
|
|
|
print(f'=== TAHUN {tahun} ===')
|
|
print(f'Total rows: {len(df)}')
|
|
|
|
# Cek kolom F5b dan F5c
|
|
has_f5b = 'F5b' in cols or 'f5b' in [c.lower() for c in cols]
|
|
has_f5c = 'F5c' in cols or 'f5c' in [c.lower() for c in cols]
|
|
|
|
print(f'Kolom F5b ada: {has_f5b}')
|
|
print(f'Kolom F5c ada: {has_f5c}')
|
|
|
|
# Sample data dari F5b dan F5c
|
|
if has_f5b:
|
|
f5b_col = 'F5b' if 'F5b' in cols else [c for c in cols if c.lower() == 'f5b'][0]
|
|
sample = df[f5b_col].iloc[0] if len(df) > 0 else None
|
|
print(f'Sample F5b: {sample}')
|
|
|
|
# Count non-empty
|
|
non_empty = df[f5b_col].notna().sum()
|
|
print(f'F5b non-empty: {non_empty}/{len(df)}')
|
|
|
|
if has_f5c:
|
|
f5c_col = 'F5c' if 'F5c' in cols else [c for c in cols if c.lower() == 'f5c'][0]
|
|
sample = df[f5c_col].iloc[0] if len(df) > 0 else None
|
|
print(f'Sample F5c: {sample}')
|
|
|
|
# Count non-empty
|
|
non_empty = df[f5c_col].notna().sum()
|
|
print(f'F5c non-empty: {non_empty}/{len(df)}')
|
|
|
|
print()
|
|
except Exception as e:
|
|
print(f'TAHUN {tahun}: ERROR - {e}')
|
|
print()
|