Period 4 · Describing Numeric Columns
[video] Lecture video — Period 4: Describing Numeric Columns — /api/lesson-media/videos/4d3653ff-a3ca-4f63-bf8e-bb93c553e599-1794847903343-889a1ead890438bb.mp4
[markdown] content available only on the platform
[markdown] content available only on the platform
Flashcards · Describing Numeric Columns
Mean — The sum of the values divided by their number; sensitive to very large or small values.
(2 + 3 + 3 + 4 + 20) / 5 = 6.4 items
Median — The middle value of the sorted data, or the average of the two middle values when n is even.
2, 3, 3, 4, 20 gives median 3.
Variance — The average squared distance from the mean, measured in squared units.
`df["quantity"].var()` gives 58.3 for the lecture data.
Standard deviation — The square root of the variance, expressed in the original unit of the data.
`df["quantity"].std()` gives about 7.64 items.
ddof — Delta degrees of freedom: the denominator is n minus ddof; pandas uses 1 by default.
`std(ddof=0)` for a complete population.
Quartiles (Q1, Q3) — The values at the 25th and 75th percentiles of the sorted data.
`df["quantity"].quantile([0.25, 0.75])` gives 3 and 4.
IQR — Interquartile range, Q3 minus Q1: the width of the middle half of the values.
4 - 3 = 1 item
df.agg() — Applies several summary functions at once and returns them in one table.
`df[cols].agg(["count", "mean", "median", "var", "std"])`
Linear interpolation — The default pandas method for quantiles that fall between two observed values.
`quantile(0.25, interpolation="linear")`
[pdf] Lecture slides — Period 4 (PDF) — /api/lesson-media/pdfs/4d3653ff-a3ca-4f63-bf8e-bb93c553e599-1794873704583-f623c972a543bd97.pdf
[markdown] content available only on the platform
