1. Home
  2. Explore
  3. Computer Science
  4. Data Visualization with Pandas and Plotly

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Data Visualization with Pandas and Plotly

Speaker 1Speaker 2

Data Visualization with Pandas and Plotly

11:58
0:00-11:58
  1. Hope

    Welcome in. Today we’re talking about data visualization—not just how to make charts, but how to make charts that help people understand a message and decide what to do. Let’s start with an unexpected example: the marble steps inside the Leaning Tower of Pisa.

  2. Maria

    The steps have worn marks from centuries of foot traffic. Even without a chart, those marks tell us something: people tended to walk in particular places on the stairs. The marble has become a visual record of that activity.

  3. Hope

    And that gets us to a simple definition. A visualization is a visual form that communicates a message. If we outline the wear on one stair, put its width on the horizontal axis and the amount of wear on the vertical axis, we’ve translated those marks into a chart. The data are still the wear patterns, but now the visual makes the pattern easier to interpret.

  4. Maria

    So visualization isn’t a mysterious technical term. It’s a way of communicating information through what people can see. And the important question isn’t only, ‘Does this look like a chart?’ It’s, ‘What message does this visual help someone understand?’

  5. Hope

    For a business visualization, the central goal is to inspire action or help stakeholders make a decision. A chart can be attractive, or it can show sophisticated analysis, but those qualities alone don’t guarantee that it’s doing its job. If the audience can’t use it to understand something or make a decision, it may be missing its purpose.

  6. Maria

    That goal combines two sides of visualization. There’s the science: mapping numbers to visual dimensions, such as position, length, size, or color. And there’s the art: choosing how to present those mappings so they tell a clear, useful story. You need both to make an impact.

  7. Hope

    Let’s make the science concrete. Suppose the number 55 is represented by a bar whose length corresponds to 55. That’s one piece of quantitative information mapped to one visual dimension: length. The number becomes something we can compare visually.

  8. Maria

    Add more data points and you can use another visual dimension. For example, bars of different lengths can represent values like 55, 45, 25, and 5, while their positions distinguish one data point from another. Now the visual encodes both the values and which point is which.

  9. Hope

    With three quantitative dimensions, a scatter plot is a natural example. Imagine fictional companies with revenue, number of employees, and market capitalization. Put revenue on the x-axis, employees on the y-axis, and use the size of each plotted point to represent market capitalization. Each visual channel carries a different part of the data.

  10. Maria

    A chart can carry even more dimensions, but more isn’t automatically better. A New York Times chart about New York City weather in 2003, for instance, combines temperature, precipitation, months, days, color distinctions for highs and lows, and additional data callouts. It can be elegant, but it also asks the viewer to decode a lot at once.

  11. Hope

    That’s where the artistic side matters. You have flexibility in how you present data because you’re not simply handing stakeholders a spreadsheet and asking them to find the story themselves. Your job is to make choices about what to summarize and what to emphasize.

  12. Maria

    A good example is the scale on a conversion-rate chart. Suppose the same data are shown three times: once with a y-axis from 3.9% to 4.5%, once from 0% to 100%, and once from 0% to 4.5%. The underlying data haven’t changed, but the visual impression does.

  13. Hope

    There isn’t one universally correct scale for those charts. The right choice depends on the message. A narrow range can emphasize that conversion rates have grown; a scale extending to 100% can emphasize how far the current rate is from a high target; and a scale starting at zero can emphasize the increase from zero.

  14. Maria

    But scale choices can influence the story, so they deserve thought. Minimum and maximum values don’t always have to appear in the display, especially if extreme values make the scale unhelpful. Still, they can help orient viewers. Ask whether those endpoints matter to the message you’re trying to communicate.

  15. Hope

    There are two common design problems to watch for. First, don’t overload a chart with visual dimensions or subgroups that don’t support your message. If viewers can’t tell what to take away, extra detail is getting in the way.

  16. Maria

    Second, avoid redundant visual dimensions—using two visual cues to show the same information without a clear reason. For example, if an area chart’s vertical position already represents a value, changing its color to represent that exact same value may confuse viewers about what the color adds. The same issue can happen when both a bar’s length and its color encode its magnitude.

  17. Hope

    Let’s apply these ideas to a business request: stakeholders want to understand the mix of the most profitable companies in the Fortune 1000, especially which industries are most prevalent. Before opening a coding notebook, set the goal: one clear message, expressed in visuals and plain English, with emphasis on what matters and no unnecessary complexity.

  18. Maria

    The example uses a curated company dataset and a Google Colab notebook. The presenter uses pandas to work with the data and Plotly to make the chart, while noting that the principles apply regardless of visualization library. The dataset has 950 companies, and the chart is designed to show revenue, profit, market capitalization, and whether a company belongs to finance or technology.

  19. Hope

    The data are prepared by selecting useful columns—company, revenue, profit, sector, and market cap—and renaming a column to make it easier to work with. Then helper fields identify whether a company is in one of the two sectors of interest and assign a category for the chart. Those fields make it easier to control color and labeling later.

  20. Maria

    The main chart is a scatter plot: company revenue goes on the x-axis and profit goes on the y-axis. Market cap determines the size of each point, and the finance-or-technology category determines its color. That gives the viewer several useful comparisons while keeping each visual dimension tied to a different piece of information.

  21. Hope

    The chart is built in steps. First, make the basic scatter plot and inspect it, including the hover information. Then set its width and height, add market cap as point size, and add color for the sector category. Plotly’s hover feature can show a company name when someone points to a data point.

  22. Maria

    Next, make the labels readable for stakeholders rather than leaving them in data terminology. Rename axis labels to phrases like ‘Company Revenue’ and ‘Company Profit,’ and phrase the category legend as a question such as ‘Is this technology or financial?’ You can also set the category order so the yes and no groups appear in the order you want.

  23. Hope

    A title can state the takeaway in plain English instead of forcing viewers to infer it from the marks. In the example, the title communicates that technology and financial companies are prominent among the most profitable companies. The presenter also highlights the relevant cluster with a rectangle and adds a text annotation explaining why it matters.

  24. Maria

    That annotation is useful because the chart should still make sense when the presenter isn’t standing beside it. A visual highlight without an explanation might leave viewers wondering why it’s there. The title and annotation work together to make the intended message explicit.

  25. Hope

    There’s an important analysis step behind that message. The presenter sorted the companies by profit and inspected the leading results before deciding to focus on finance and technology. The top ten were mainly from those sectors, with a communications company also appearing. That’s a reminder not to choose a visual story before checking what the data actually show.

  26. Maria

    And there’s a broader stakeholder lesson: make sure the question itself is relevant before you build a chart. Ask about the stakeholder’s priorities, pain points, goals, and risks. If the requested analysis won’t help with the decision they care about, clarify the question first rather than spending time visualizing the wrong thing.

  27. Hope

    People also ask how much of the impact comes from the software. The answer in this discussion is that strategy, analysis, and communication matter more than choosing a particular library. Excel, Python, R, Plotly, Matplotlib, Tableau, Power BI, and other tools can all be useful; pick what works for the task and the person doing it.

  28. Maria

    For presenting to stakeholders, though, showing code usually isn’t the point. Stakeholders need the data and the story, not a tour through the programming. A chart might be made in Python and then placed into a slide deck or document for the actual presentation.

  29. Hope

    Different tools offer different balances of flexibility and ease of use. The discussion describes D3 as highly flexible but harder to learn, with Plotly offering a middle ground. The practical advice is to use the tool you’re comfortable with, rather than letting the tool become the focus.

  30. Maria

    Interactivity depends on what you want viewers to do. Plotly offers features such as hovering and controls for ranges or filters, but a chart in a notebook may need to be hosted for other people to access it. Google Data Studio was also suggested as a free option for interactive dashboards.

  31. Hope

    If you want labels beside every point instead of in a hover box, one approach is to use the plotting library’s labeling options. Another is to add annotations programmatically—for instance, adding company names to selected points. But labels can clutter a chart, so use them where they help the intended message.

  32. Maria

    And how do you choose between a table and a chart? Start with the takeaway you want the stakeholder to know. That goal can help you decide whether a table, line chart, bar chart, or scatter plot is the clearest form for the information.

  33. Hope

    For someone building data-analysis skills, the presenter described four useful areas to develop: storytelling and visualization, business strategy, handling data, and statistical analysis. A background in software engineering can help, especially for more engineering-focused work, but it isn’t a requirement for beginning to learn data analysis.

  34. Maria

    Nor does moving from spreadsheets to Python have to feel like starting from nothing. If you’re comfortable with rows and columns, formulas, and conditional logic in Excel, some of those ideas carry over. Documentation and targeted searches—like looking up how to change scatter-plot point size in Plotly—can help you find specific commands.

  35. Hope

    Python is commonly used in business analysis, though Excel was described as the most widely used tool in that setting. The presenter’s personal preference was Python, partly because of its community support, while emphasizing that tool choice is secondary to doing sound analysis and communicating it well.

  36. Maria

    And communication gets better through practice. The presenter credited a strong storytelling culture, a helpful manager and mentor, repeated attempts, and learning from failures. There isn’t a shortcut that replaces building the skill over time.

  37. Hope

    So the thread running through all of this is simple: begin with the decision or message, check that the question is worth answering, map data to visual cues carefully, and remove anything that distracts from the point. Then make the takeaway clear enough that your audience can understand it and act on it.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent