Exercise 2: Choosing the Right Chart for Two Different Questions — Possible Solution ==================================================================== QUESTION 1: COMPARING TOTAL REVENUE ACROSS THE TWO STORES ------------------------------ Per this chapter's own chart-type table, the question "How do these categories compare?" maps to a Bar chart, described as delivering "on ds1-5's own groupby results." Comparing total revenue across two specific, discrete stores is exactly this kind of question — the two stores are discrete categories (not a continuous range), and the goal is comparing one summary number (total revenue) per category side by side. This would use exactly the same pattern as this chapter's own "Bar Plot — Revenue by Product" example, but grouped by store_name instead of product: a groupby("store_name")["revenue"].sum() result fed directly into ax.bar(...). QUESTION 2: WHETHER ORDER QUANTITY AND REVENUE MOVE TOGETHER ------------------------------ Per this chapter's own table, the question "Are these two variables related?" maps to a Scatter chart, described as delivering "on ds1-6's own correlation coefficient." Quantity and revenue are both continuous, numeric variables (not discrete categories), and the question is specifically about the relationship between them — exactly the kind of question this chapter's own "Scatter Plot — Quantity vs. Revenue" example already demonstrates directly. WHY EACH CHOICE FITS ds1-6's OWN VOCABULARY ------------------------------ The store-comparison question is fundamentally a "how do discrete groups compare on one summary statistic" question — exactly what ds1-5's own groupby operation computes, and exactly what a bar chart is built to display: one bar's height per category. The quantity-vs- revenue question is fundamentally about the relationship between two continuous variables, which is precisely what ds1-6 defined correlation to measure numerically (Pearson's coefficient, from −1 to 1) — a scatter plot is the direct visual counterpart of that same numeric concept, letting a reader see the same relationship a correlation coefficient would summarize as a single number. WHY A BAR CHART WOULDN'T FIT THE SECOND QUESTION (AND VICE VERSA) ------------------------------ A bar chart requires discrete categories on one axis — quantity and revenue are both continuous, so there's no natural set of "categories" to put bars side by side for. A scatter plot, conversely, is built to show many individual (x, y) points spread across two continuous axes — plotting only two store totals as individual points would show almost nothing useful, since there's no meaningful continuous relationship being investigated between just two discrete groups. WHY THIS WORKS AS AN ANSWER ------------------------------ It matches each question to the chapter's own table entry precisely (categories-compared → bar, relationship-between-variables → scatter), and explains why each choice specifically fits the underlying statistical concept from ds1-6 (groupby comparison vs. correlation) that the chosen chart type visually represents.