-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleaningdata.py
More file actions
34 lines (27 loc) · 989 Bytes
/
Copy pathcleaningdata.py
File metadata and controls
34 lines (27 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pandas as pd
df = pd.read_csv('cumulative_2026.04.12_06.34.10.csv', comment='#')
print(df.shape)
print(df['koi_disposition'].value_counts())
print(df.isnull().sum().sort_values(ascending=False).head(20))
# Drop columns with >50% missing
threshold = 0.5
df_clean = df.dropna(thresh=len(df) * threshold, axis=1)
print(df_clean.shape)
# Drop non-feature columns
drop_cols = [
'rowid', 'kepid', 'kepoi_name', 'koi_vet_stat', 'koi_vet_date',
'koi_pdisposition',
'koi_disp_prov', 'koi_comment', 'koi_fittype', 'koi_limbdark_mod',
'koi_parm_prov', 'koi_tce_delivname', 'koi_quarters', 'koi_trans_mod',
'koi_datalink_dvr', 'koi_datalink_dvs', 'koi_sparprov',
'koi_eccen'
]
target = 'koi_disposition'
df_model = df_clean.drop(columns=drop_cols)
X = df_model.drop(columns=[target])
y = df_model[target]
print(f"Features: {X.shape}")
print(X.dtypes.value_counts())
# Save cleaned dataset
df_model.to_csv('koi_clean.csv', index=False)
print("Saved koi_clean.csv")