สำรวจ Base Table
ก่อนเริ่มสร้างโมเดล ควรทำความเข้าใจข้อมูลที่จะใช้งานให้ดีเสียก่อน ในแบบฝึกหัดนี้ จะได้เรียนรู้วิธีดึงข้อมูลขนาดประชากร จำนวน target และ target incidence จาก basetable ที่กำหนดให้
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
การวิเคราะห์เชิงพยากรณ์เบื้องต้นด้วย Python
คำแนะนำการฝึกหัด
- โหลด basetable ไว้ในออบเจกต์ pandas ชื่อ
basetableแล้ว — กำหนดจำนวนแถวให้กับตัวแปรpopulation_sizeและพิมพ์ค่าออกมา - กำหนดจำนวน target ที่มีค่าเท่ากับ 1 ให้กับตัวแปร
targets_countและพิมพ์ค่าออกมา - พิมพ์ค่า target incidence ซึ่งคืออัตราส่วนของ
targets_countต่อpopulation_size
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Assign the number of rows in the basetable to the variable 'population_size'.
population_size = ____(____)
# Print the population size.
print(____)
# Assign the number of targets to the variable 'targets_count'.
targets_count = ____(____[____])
# Print the number of targets.
print(____)
# Print the target incidence.
print(____ / ____)