การแจกแจง: hist, kde และ box
มองเห็นรูปร่างของตัวแปรหนึ่งตัว
การแจกแจง: hist, kde และ box เป็นบทเรียน Data Science Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Data Science Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Data Science Academy มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
See the Shape of One Column
Before averages, look at the whole spread. A distribution plot shows how often each value appears across a single column.
The Histogram
A histogram drops values into bins and draws a bar for each. Tall bars mark the values that show up most often.
sns.histplot(data=df, x="age")Bins Change the Story
Too few bins hide detail, too many add noise. Adjusting bins tunes how coarse or fine the histogram looks.
sns.histplot(data=df, x="age", bins=20)A Smooth Curve: KDE
A KDE plot draws a smooth curve instead of bars, estimating the density of values. It reveals the overall shape at a glance.
sns.kdeplot(data=df, x="age")Histogram Plus KDE Together
Want both the bars and the smooth line? Add kde=True to a histogram and seaborn overlays the curve for you.
sns.histplot(data=df, x="age", kde=True)Read the Peaks
One hump means a single common range, two humps hint at two groups. The number of peaks often signals hidden subgroups in your data.
The Box Plot
A box plot squeezes the distribution into five numbers: the median, the middle half, and the reach of the data.
sns.boxplot(data=df, y="income")Read the Box and Whiskers
The line inside is the median, the box is the middle 50 percent, and the whiskers stretch toward the typical extremes.
Spot Outliers Instantly
Dots beyond the whiskers are flagged as outliers. Box plots make these unusual values jump right off the screen.
Compare Groups Side by Side
Add a category to x and the box plot splits by group. Now you can compare the spread of income across each team at once.
sns.boxplot(data=df, x="team", y="income")Which Plot, When?
Reach for a histogram or KDE to see shape, and a box plot to compare groups and catch outliers fast.
Quick Check
You want to compare spread across categories and spot outliers.
Recap: Three Views of One Column
You can now read a column three ways: histograms for counts, KDE for smooth shape, and box plots for spread and outliers. 📈
คำถามที่พบบ่อย
บทเรียน “การแจกแจง: hist, kde และ box” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “การแจกแจง: hist, kde และ box” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Data Science Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Data Science Academy มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “การแจกแจง: hist, kde และ box”
มองเห็นรูปร่างของตัวแปรหนึ่งตัว คุณปฏิบัติ Data Science Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Data Science Academy หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Data Science Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน
บทเรียน “การแจกแจง: hist, kde และ box” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Data Science Academy นี้ได้ไหม
ได้ บทเรียน Data Science Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- เหตุใดจึงใช้ seaborn แทน matplotlib แบบพื้นฐาน
- การแจกแจง: hist, kde และ box
- ความสัมพันธ์: scatter และ line
- แฟกเซ็ต สี และรูปแบบ