Skip to content

5.4 Capstone Briefing

ถึงเวลาเอาทุกอย่างมารวมกัน — คุณจะได้ไฟล์ CSV ที่ “ยุ่งเหยิง” แล้วต้องแปลงมันให้เป็นข้อมูลที่เชื่อถือได้ใน 3 ระบบ พร้อม type contract

เวลาที่ใช้: ~15 นาที (อ่าน briefing)

ภาพรวมโปรเจกต์

Section titled “ภาพรวมโปรเจกต์”

คุณเป็น Data Type Translator — คนที่รับ messy CSV จากทีมอื่น แล้วแปลงให้เป็นข้อมูลที่ถูกต้องและเชื่อถือได้ใน Google Sheets, Python (pandas), และ SQL

Messy CSV คุณ: Data Type Translator Cleaned Google Sheet Cleaned pandas Notebook SQL Schema + Load Script Type Contract Memo

ไฟล์ CSV นี้มีปัญหาต่อไปนี้ (ตั้งใจให้มี):

ปัญหาตัวอย่างควรเป็น
Leading zeros หายstudent_id = 1234001234
Date format ปนกัน15/01/2025, 2025-01-15, Jan 15, 20252025-01-15 (ISO)
Empty vs null vs zero ปน"", ว่างเปล่า, 0แยกให้ถูก
ตัวเลขที่ดูเหมือน text"2,500.00" (มี comma)2500.00 (numeric)
Phone มีรูปแบบปน0812345678, +66812345678, 081-234-5678เลือกรูปแบบเดียว
Boolean ปนกันTRUE, yes, 1, Yเลือกรูปแบบเดียว

ตัวอย่างข้อมูล

Section titled “ตัวอย่างข้อมูล”
student_id,name,phone,price,enrolled_on,active,note
1234,Somchai Jaidee,0812345678,"2,500.00",15/01/2025,yes,
001235,Somsri Deejai,+66812345679,1800.50,2025-01-16,TRUE,นักเรียนทุน
1236,Somying Sabaidi,,0,Jan 17 2025,1,
001237,Somkid Jaijing,081-234-5680,"3,200.00",2025-01-18,Y,note ปกติ
001238,Sompong Jaiyen,"","1,500.00",19/01/2025,yes,""

Deliverables (สิ่งที่ต้องส่ง)

Section titled “Deliverables (สิ่งที่ต้องส่ง)”
  1. Cleaned Google Sheet

    • ทุก column มี data type ที่ถูกต้อง
    • student_id เป็น text 6 หลัก (มี leading zeros)
    • price เป็น number ไม่มี comma
    • enrolled_on เป็น date format เดียว
    • active เป็น TRUE/FALSE
    • data validation rules ตั้งไว้
  2. Cleaned pandas Notebook

    • อ่าน CSV ด้วย dtype mapping ที่ถูกต้อง
    • clean ทุก column ให้ตรง type contract
    • รัน import checklist (5 checks) และ print ผลลัพธ์
    • export เป็น cleaned CSV
  3. SQL Schema + Load Script

    • CREATE TABLE statement ที่มี type ถูกต้อง + constraints
    • INSERT statements หรือ COPY command สำหรับ load ข้อมูล
    • verification queries (row count, nulls, totals)
  4. Type Contract Memo

    • ตาราง 1 หน้าที่ระบุ column, type, required/nullable, constraints
    • เหมือนตัวอย่างใน lesson 5.1

เกณฑ์การให้คะแนน (Rubric)

Section titled “เกณฑ์การให้คะแนน (Rubric)”
เกณฑ์คะแนนรายละเอียด
Row counts match20%จำนวนแถวใน Sheets, pandas, SQL ตรงกัน
IDs preserved15%student_id มี leading zeros ครบ 6 หลักในทุกระบบ
Dates correct20%ทุก date เป็น ISO 8601 (YYYY-MM-DD) ในทุกระบบ
Numeric types correct20%price ไม่มี rounding error, ไม่มี comma, ยอดรวมตรง
Type contract complete25%มีทุก column, ระบุ type + nullable + constraints ครบ
รวม100%

เครื่องมือที่แนะนำ

Section titled “เครื่องมือที่แนะนำ”
  • Import: File > Import > Upload > ตั้ง column type เป็น “Do not convert”
  • Clean IDs: =TEXT(A2, "000000") สำหรับเติม leading zeros
  • Clean Dates: =DATEVALUE() หรือแก้ด้วยมือ + format เป็น YYYY-MM-DD
  • Clean Numbers: Find & Replace → ลบ comma ออก
  • Validate: Data > Data validation สำหรับทุก column
ช่วงเวลางานเวลา
1อ่าน CSV, วิเคราะห์ปัญหา, เขียน type contract20 min
2Clean ใน Google Sheets25 min
3Clean ใน pandas notebook30 min
4เขียน SQL schema + load + verify25 min
5ตรวจสอบ cross-platform: ยอดตรงกันทั้ง 3 ที่10 min
6Review type contract memo ครั้งสุดท้าย10 min
รวม~120 min