
ภาพรวมเกี่ยวกับบทเรียน

เรียนรู้วิธีการล้างข้อมูลเพื่อเตรียมการสำหรับการจัดแสดงผล
ในบทเรียน Google Sheets: การลบข้อมูลจากอินเทอร์เน็ต ก่อนหน้านี้ เราได้เรียนรู้วิธีการนำเข้าตารางจากเว็บผ่านฟังก์ชั่น importHTML ในบทเรียนนี้เราจะเรียนรู้วิธีการล้างข้อมูลเพื่อให้พร้อมสำหรับการวิเคราะห์และจัดแสดงผล
- การจัดทำข้อมูลให้สามารถแก้ไขได้
- การแก้ไขข้อมูล
- การแก้ไขข้อมูลเป็นชุดผ่าน Find and replace
ดูรายละเอียดเพิ่มเติมเกี่ยวกับวิชา การนำเสนอข้อมูล ได้ที่:
newsinitiative.withgoogle.com/training/course/data-journalism

การจัดทำข้อมูลให้สามารถแก้ไขได้



“การล้างข้อมูล” หมายถึงการทำให้ข้อมูลสามารถจัดการได้: เพื่อให้ตารางข้อมูลมีความถูกต้องสมบูรณ์ ปราศจากข้อขัดแย้งและอยู่ในรูปแบบที่คอมพิวเตอร์สามารถเข้าใจได้ ซึ่งหมายถึงเราจะทำการลบแถวข้อมูลที่ซ้ำซ้อน ลบอักขระที่ไม่ต้องการและตรวจสอบให้แน่ใจว่าคอลัมน์ข้อมูลมีข้อมูลอยู่เพียงประเภทเดียว เช่น ตัวเลขหรือข้อความ ไม่ใช่ปะปนกัน เริ่มจากการทำให้ข้อมูลสามารถแก้ไขได้
ตารางนี้เป็นผลงานจากการใช้ importHTML ในแบบฟอร์มนี้ การเปลี่ยนแปลงใด ๆ กับแหล่งข้อมูล (หน้า Wikipedia) จะแสดงผลอัตโนมัติที่นี่ และมีการอัพเดตอย่างน้อยทุก ๆ หนึ่งชั่วโมง อย่างไรก็ตาม เราไม่สามารถแก้ไขค่าในเซลล์เพื่อลบส่วนประกอบที่ไม่ต้องการได้ เราจะใช้ paste special จาก Google Sheets เพื่อจัดทำสแนปช็อตคงที่สำหรับข้อมูลดังกล่าว ในกรณีนี้เราจะไม่สามารถอัพเดตตารางอัตโนมัติผ่าน importHTML แต่จะสามารถแก้ไขข้อมูลได้
เลือกข้อมูลทั้งหมดโดยคลิกซ้ายที่รูปสี่เหลี่ยมผืนผ้าด้านบนในเอกสารของคุณ หลังจากเซลล์ถูกแรเงาเลือก ให้คลิกที่ Edit > Copy เลือก Edit > Paste special > Paste values only ตอนนี้เราจะสามารถแก้ไขตารางดังกล่าวได้
เพื่อให้แก้ไขได้ง่ายยิ่งขึ้น เราจะตรึงแถวไว้พร้อมกับชื่อของคอลัมน์เหล่านี้ เลื่อนเคอร์เซอร์เมาส์ไปที่เส้นเหนือแถวที่ 1 ด้านบนแถบสีเทา คุณจะเห็นเคอร์เซอร์เปลี่ยนเป็นรูปถุงมือ ลากแถบรายการไปที่ด้านล่างของแถว 1 แล้วปล่อยทิ้งไว้ ตอนนี้แถวบนสุดได้ถูกตรึงไว้แล้ว



การแก้ไขข้อมูล



importHTML จะทำการนำเข้าอักขระที่เหลือจากตารางของ Wikipedia ที่เป็นประโยชน์สำหรับผู้ใช้แต่ไม่เป็นประโยชน์สำหรับคอมพิวเตอร์ไว้ เราจะลบข้อมูลในส่วนนี้เพื่อให้ตารางข้อมูลของเราดูเรียบร้อยมากยิ่งขึ้น!
เนื่องจากเราไม่ต้องการคอลัมน์ F สำหรับแบบฝึกหัดนี้ ดังนั้นให้คลิกขวาที่ตัว F ด้านบนของคอลัมน์แล้วเลือก Delete
จะเห็นตัวอักษร “F” ติดกับเลข 13 ในแถว A14 และ “TS3” ติดกับเลข 4 ในเซลล์ B27 เราจะทำการลบอักขระเหล่านี้เพื่อให้เหลือเฉพาะเลข 13 และ 4
ลบอักขระส่วนเกินในเซลล์ B40 และ B48 เพื่อให้เหลือแต่เลข 19 และ 8 ทำอย่างเดียวกันกับเซลล์ D17 เพื่อลบเซลล์ “F8” ด้านหน้า



การแก้ไขข้อมูลเป็นชุดผ่าน Find and replace





ตอนนี้ลองดูที่คอลัมน์ C แล้วลบอักขระ * ด้านหน้าโดยใช้ Find and replace แทนที่จะต้องทำทีละแถว
เลือกคอลัมน์ C โดยคลิกซ้ายที่ตัวอักษร C ด้านบนของคอลัมน์ เลือก Edit > Find and replace
ในกล่องข้อความแรก ให้พิมพ์สัญลักษณ์ดอกจันลงไป: * (อักขระที่ต้องการค้นหาในคอลัมน์ C) ปล่อยช่อง Replace with ว่างไว้เพื่อให้มีการแทนที่ดอกจันทร์ด้วยอักขระเปล่าหรือคือการลบอักขระทิ้งนั่นเอง
ตัวเลือก Search จะต้องระบุเป็น Specific range และช่วงที่กำหนดจะต้องตรงกับคอลัมน์ที่คุณเลือกไว้ ปล่อยช่องทำเครื่องหมายว่างไว้
เลือก Replace allจะเห็นว่า Google Sheets แจ้งให้คุณทราบว่ามีการ Replaced 100 instances of * with (nothing). ซึ่งหมายถึงตอนนี้คุณลบอักขระ 100 ตัวในแถว 50 แถวได้แล้วโดยการคลิกเลือกเพียงไม่กี่ครั้ง!
เลือก Done ตารางของเราตอนนี้สะอาดเรียบร้อยและพร้อมสำหรับการใช้งานแล้ว ในบทเรียนถัดไป เราจะทำการแสดงข้อมูลและเจาะรายละเอียดจากข้อมูลดังกล่าว





ขอแสดงความยินดี!

คุณผ่านบทเรียน “Google Sheets: การล้างข้อมูล”
พัฒนาทักษะด้านวารสารศาสตร์ในระบบดิจิตอลของคุณต่อไป พร้อมรับการรับรองจาก Google News Initiative โดยไปที่เว็บไซต์ศูนย์ฝึกอบรมของเราและศึกษาบทเรียนเพิ่มเติม
ดูรายละเอียดเพิ่มเติมเกี่ยวกับวิชา การนำเสนอข้อมูล ได้ที่:
newsinitiative.withgoogle.com/training/course/data-journalism

-
-
ปกป้องพื้นที่ข่าวการเลือกตั้งของคุณ
บทเรียนในโมดูลนี้ เราจะดูเครื่องมือที่ใช้ปกป้องและรักษาความปลอดภัยให้พื้นที่ข่าวการเลือกตั้งของคุณ -
Google Scholar: การเข้าถึงคดีในศาล บทความและแหล่งข้อมูลทางวิชาการ
บทเรียนค้นหาข้อเท็จจริงที่หายากและความคิดเห็นของผู้เชี่ยวชาญอย่างรวดเร็ว