Mô hình hóa Rủi ro Tín dụng bằng Python
Michael Crabtree
Data Scientist, Ford Motor Company
''| Loại dữ liệu thiếu | Kết quả có thể |
|---|---|
| NULL ở cột số | Lỗi |
| NULL ở cột chuỗi | Lỗi |
| Dữ liệu thiếu | Diễn giải | Hành động |
|---|---|---|
NULL ở loan_status |
Khoản vay mới được duyệt | Loại khỏi dữ liệu dự đoán |
NULL ở person_age |
Chưa ghi/không cung cấp tuổi | Thay bằng trung vị |
isnull()sum().any() kiểm tra toàn bộ cộtnull_columns = cr_loan.columns[cr_loan.isnull().any()]
cr_loan[null_columns].isnull().sum()
# Tổng số giá trị null theo cột
person_home_ownership 25
person_emp_length 895
loan_intent 25
loan_int_rate 3140
cb_person_default_on_file 15
.fillna() với các hàm/method tổng hợpcr_loan['loan_int_rate'].fillna((cr_loan['loan_int_rate'].mean()), inplace = True)
.drop()indices = cr_loan[cr_loan['person_emp_length'].isnull()].index
cr_loan.drop(indices, inplace=True)
Mô hình hóa Rủi ro Tín dụng bằng Python