การสร้างโมเดลความเสี่ยงด้านเครดิตด้วย Python
Michael Crabtree
Data Scientist, Ford Motor Company
''| ประเภทข้อมูลที่หายไป | ผลลัพธ์ที่อาจเกิดขึ้น |
|---|---|
| NULL ในคอลัมน์ตัวเลข | Error |
| NULL ในคอลัมน์สตริง | Error |
| ข้อมูลที่หายไป | การตีความ | การดำเนินการ |
|---|---|---|
NULL ใน loan_status |
สินเชื่อที่เพิ่งได้รับอนุมัติ | ลบออกจากข้อมูลสำหรับการพยากรณ์ |
NULL ใน person_age |
ไม่ได้บันทึกหรือไม่เปิดเผยอายุ | แทนที่ด้วยค่ามัธยฐาน |
isnull()sum().any() ตรวจสอบทุกคอลัมน์null_columns = cr_loan.columns[cr_loan.isnull().any()]
cr_loan[null_columns].isnull().sum()
# Total number of null values per column
person_home_ownership 25
person_emp_length 895
loan_intent 25
loan_int_rate 3140
cb_person_default_on_file 15
.fillna() ร่วมกับฟังก์ชัน aggregatecr_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)
การสร้างโมเดลความเสี่ยงด้านเครดิตด้วย Python