Automatically translated.View original post

🐼 3 Pandas settler postures used by AI Engineer until professional! ✨

"Garbage In, Garbage Out!" 🗑️ If the data is rubbish, the results are rubbish!

.

Today, let's share 3 Pandas commands that AI Engineer has to press every day until close your eyes! 👩‍💻👨‍💻

.

1️⃣ Fillna (): Data lost, not a problem! Plug holes with one-click averages. Don't be afraid, AI cries Error! 🛠️

2️⃣ get _ dummies (): Turn "male-female" into one-hot Encoding, because AI talks with numbers! 🤖

3️⃣ query (): Filter the data as sensitive as ordering papaya salad! "Take only members whose purchases exceed tens of thousands." Write one line, end! 🥗

.

⚠️ Newbie Warning: Beware of Pandas Eating RAM Like Water! If the file is big, don't forget to use the Chunking technique or skip to find Polars instead! 🚀

.

Save it! Who wants to know anything about Data? Comment it. 👇

# Data ascience # Developer # programmer # selfdevelopment # learnonlemon8

1/12 Edited to

... Read moreสำหรับคนที่เริ่มต้นใช้งาน Pandas อาจสงสัยว่า DataFrame หรือ df คืออะไร? DataFrame คือโครงสร้างข้อมูลตารางที่มีแถวและคอลัมน์เหมือน Excel แต่ทำงานได้ยืดหยุ่นและรวดเร็วในภาษา Python โดย Pandas เป็นไลบรารีที่ช่วยจัดการข้อมูลเหล่านี้อย่างมีประสิทธิภาพ การเข้าใจ DataFrame และการใช้คำสั่ง Pandas อย่าง fillna() จะช่วยให้เราจัดการกับข้อมูลที่หายไป (NaN) ได้ง่ายขึ้น เช่น เติมค่ากลางหรือค่าเฉลี่ยแทนค่าว่างเพื่อไม่ให้ AI Model เจอปัญหา นอกจากนี้ การใช้ get_dummies() เป็นวิธีที่ดีในการแปลงข้อมูลประเภทข้อความ เช่น 'ชาย' หรือ 'หญิง' ให้กลายเป็นค่าตัวเลข 0 หรือ 1 เพื่อให้ AI สามารถประมวลผลได้อย่างถูกต้อง ส่วน query() ช่วยให้เราเลือกข้อมูลที่ต้องการได้อย่างรวดเร็ว เช่น การกรองสมาชิกที่มียอดซื้อเกินหมื่นบาท ทำให้วิเคราะห์ข้อมูลเฉพาะกลุ่มได้ง่ายขึ้นโดยไม่ต้องเขียนโค้ดยาว แต่ควรระวังว่า Pandas ใช้ RAM มากเมื่อทำงานกับข้อมูลขนาดใหญ่ ดังนั้นเทคนิคอย่าง Chunking ที่แบ่งข้อมูลเป็นส่วนเล็กๆ หรือเปลี่ยนไปใช้ไลบรารีอย่าง Polars ซึ่งออกแบบมารองรับข้อมูลใหญ่จะช่วยลดปัญหานี้ได้อย่างดี ในฐานะคนใช้ Pandas อยู่นาน ผมแนะนำให้เริ่มต้นด้วยการเรียนรู้คำสั่งพื้นฐานเหล่านี้และทดลองโค้ดกับข้อมูลจริง จะช่วยให้เข้าใจการใช้งานและปัญหาที่อาจเกิดขึ้นกับ DataFrame ได้อย่างลึกซึ้ง และทำให้งาน Data Science หรือ AI ของคุณเป็นมืออาชีพมากขึ้น