ใน ep ที่แล้ว เราใช้ Pandas Profiling ในการช่วยทำการสำรวจข้อมูล Exploratory Data Analysis (EDA) แต่ถ้าเราต้องการเปลี่ยนแปลงข้อมูลนิด ๆ หน่อย ๆ หรือเราต้องการพล็อตกราฟที่ใน Pandas Profiling ไม่มีมาให้ล่ะ จะทำอย่างไร เราสามารถใช้ Pandas_UI มาช่วยได้

Pandas_UI คืออะไร

Pandas_UI Main UI
Pandas_UI Main UI

Pandas_UI คือ เครื่องมือหน้าจอ User Interface Tools ที่ช่วยอำนวยความสะดวกให้เราสามารถจัดการ และแก้ไขข้อมูลใน Pandas DataFrame ได้อย่างรวดเร็ว และง่ายดาย

เราสามารถเลือก Row, Column, เงื่อนไข และ Operation ที่ต้องการใน Pandas_UI จะช่วย Generate Code ภาษา Python ให้เรา โดยที่เราไม่ต้องจำชื่อฟังก์ชัน ชื่อพารามิเตอร์ต่าง ๆ

Pandas_UI ถูกสร้างด้วยเทคโนโลยีที่เราคุ้นเคย เช่น NumPy, plotly, ipywidgets, pandas_profiling, qgrid โดยสร้างเป็น Jupyter Notebook Extension ทำให้สามารถรันใน Jupyter Notebook ได้เลย

เรามาเริ่มกันเลยดีกว่า

ด้วย Code เพียงแค่ 3 บรรทัด

pip install pandas_ui
jupyter nbextension enable --py qgrid --sys-prefix
jupyter nbextension enable --py widgetsnbextension --sys-prefix

Open In Colab

ตัวอย่างหน้าจอการใช้งาน

หน้าจอหลัก

Pandas_UI Main UI
Pandas_UI Main UI

ลบ Row ที่เลือกไว้

Panda_UI Remove Selected Rows
Panda_UI Remove Selected Rows

ประวัติการแก้ไข เราสามารถนำโค้ด Python ที่ Generate มาให้ไปใช้ต่อได้เลย

Panda_UI History
Panda_UI History

แก้ไขข้อมูลใน DataFrame โดยตรง

Panda_UI Add new rows and Modify Data
Panda_UI Add new rows and Modify Data

มีฟังก์ชัน Pandas Profiling Report ในตัว

Panda_UI Pandas Profiling Report Variables
Panda_UI Pandas Profiling Report Variables
Panda_UI Pandas Profiling Report Correlations
Panda_UI Pandas Profiling Report Correlations

เลือก 1 Column มาพล็อต Histogram เราสามารถนำโค้ด ภาษา Python ที่ Generate มาให้ไปใช้ต่อได้เลย

Pandas_UI Plots Histogram
Pandas_UI Plots Histogram

รองรับกราฟ 3 มิติ

Pandas_UI Plots Scatter 3D
Pandas_UI Plots Scatter 3D

ตัวอย่างหน้าจอพล็อตกราฟ 3 มิติ Scatter 3D เราไม่ต้องจำชื่อ Parameter

Pandas_UI Form for Plots Scatter 3D
Pandas_UI Form for Plots Scatter 3D

หน้าจอสร้างคำสั่ง Update ข้อมูลทีละเยอะ ๆ ตามเงื่อนไขที่กำหนด

Panda_UI Pandas Update Table Value Operation on Condition
Panda_UI Pandas Update Table Value Operation on Condition

Credit

หมายเหตุ

  • Library นี้ใหม่มาก ยังมี Bug อยู่หลายจุด
  • ถ้าเกิด Error ให้รัน Cell ใหม่
  • ขณะนี้ยังไม่รองรับ Google Colab

แชร์ให้เพื่อน:

Surapong Kanoktipsatharporn on FacebookSurapong Kanoktipsatharporn on LinkedinSurapong Kanoktipsatharporn on Rss
Surapong Kanoktipsatharporn
Solutions Architect at Bua Labs
The ultimate test of your knowledge is your capacity to convey it to another.

Published by Surapong Kanoktipsatharporn

The ultimate test of your knowledge is your capacity to convey it to another.