import pymysql conn = pymysql.connect(host='localhost', user='root', password='', database='tracerstudy_db', port=3306, charset='utf8mb4') cursor = conn.cursor() # Cek count NULL per kolom penting columns_to_check = [ 'email', 'nama_perusahaan', 'jabatan', 'status_saat_ini', 'bulan_dapat_kerja', 'etika_lulus_full', 'etika_saat_ini', 'cari_iklan', 'cari_internet', 'jumlah_perusahaan_dilamar', 'jumlah_perusahaan_merespons' ] # Get total count cursor.execute('SELECT COUNT(*) FROM tracer_responses') total = cursor.fetchone()[0] print('=== NULL COUNT di tracer_responses ===') print(f'Total data: {total}') print() print('{:<35} {:<8} {:<8} {:<8}'.format('Kolom', 'Terisi', 'NULL', '%')) print('-' * 60) for col in columns_to_check: cursor.execute(f'SELECT COUNT(*) FROM tracer_responses WHERE {col} IS NOT NULL') non_null = cursor.fetchone()[0] null_count = total - non_null pct = (non_null / total * 100) if total > 0 else 0 print(f'{col:<35} {non_null:<8} {null_count:<8} {pct:.1f}%') conn.close()