Skip to content

Pandas & Plotting

Plot to See Patterns

8 min+75 XPStep 1/10

Plotting is a diagnostic, not decoration

pandas borrows matplotlib, so plotting is one method call:

  • df['price'].plot.hist(bins=50) — a histogram reveals skew, outliers, and the long tail describe() hides
  • df.plot.scatter(x='sqft', y='price') — relationships, clusters, and the point that's 100× too big
  • plt.plot(epochs, losses) — the training curve, ML's favorite chart

For prettier defaults and group coloring, seaborn wraps the same engine: sns.scatterplot(data=df, x='sqft', y='price', hue='neighborhood') colors points by category with a single argument. A figure that takes 30 seconds routinely saves three days of modeling the wrong thing.

insight

describe() tells you the mean is 350k. The histogram tells you the distribution is bimodal. Same data — only one of those changes what you do next.