Business leaders are dumb. That's what a lot of business analysts think because they create something "awesome" with a dataset and then it gets ignored. Unfortunately, these types of business analysts don't realize that leaders aren't dumb. They are just busy. They are responsible for making decisions and making them quickly. And leaders need answers (based on data) more than anything. Think about it: if they need answers and you have the skills to provide those answers... You become their go-to data person. The best way I've found to do that (based on my 15+ years of industry experience in solving real-world business problems with data) is to create dashboards that answer these questions. And that's what you'll learn in today's in-depth tutorial. By the way, if you haven't snagged your copy of The Data Analytics Portfolio Playbook, now's the time! Get up and running in two weeks or less. Data visualizations are awesome for your portfolio. The playbook includes everything you need to create an awesome portfolio -- including how to host for free. Here's a specific example of what's possible when you follow the proven playbook. Never send an Excel "report" again.When you send a basic Excel report to a business leader, you send a signal:
Instead, you can build an awesome interactive dashboard for executives that answers questions (and answers them quickly) using Python and Dash. Here's the step-by-step guide to take you through the entire process.
If you want to follow along with the code, here's the notebook. And here's what you will build by the end of this tutorial: Step 1: Set Up Your EnvironmentFirst, install and import the necessary Python packages:
Step 2: Prepare the DataNext, let's load up our data set and prepare the data for the dashboard: For this tutorial, we're using the Superstore data set which shows fake sales data for a fake store. You should replace this with your own data set. To prepare the data, we convert the Order Date column to a date object and also create a new Order Month column to summarize our data for a cleaner dashboard look. Then, we use the groupby function to aggregate the data by Region and Order Month. Our final data prep step is to create a Profit Ratio column based off monthly Profit and Sales. Here's the code:
Step 3: Create the Dashboard LayoutThen, let's create a 4-panel dashboard, with 2 charts on top and 2 on the bottom. This is a great way to answer questions and solve business problems by piecing together a story. Let's also add our dropdown in this step so that the end user can select any region:
Step 4: Add Callbacks for the Interactive Dropdown FiltersTo make the Region dropdown filter work, we need to add 'callbacks' into our code. Let's also create a function to create the figures (graphs) as needed. This allows us to pass in a Region from the data set and get back out each of the figures we want to display in the dashboard. Here's the code:
Step 5: Run the Dashboard and Share Your InsightsFinally, we're ready to run the dashboard.
Here's what it should look like! If you followed along with the step-by-step tutorial, you're well on your way to mastering the fundamentals of data analytics with Python:
Never feel frustrated when communicating with data again.The best way to avoid feeling insecure about communicating with business leaders with data is to build something that actually answers their questions. And you have to do it quickly and effortlessly, which is where this tutorial helps. Four things to keep in mind about building interactive dashboards with Python:
Did this tutorial help? Hit reply and let me know or fill out this quick survey. Until next time, keep exploring and happy blending! Brian (say hi on X/Twitter!) Whenever you're ready, here's how I can help you:
|
You are receiving this because you signed up for Starting with Data, purchased one of my data analytics products, or enrolled in one of my data analytics courses. Unsubscribe any time using the link below. 600 1st Ave, Ste 330 PMB 92768, Seattle, WA 98104-2246 |
Learn to build analytics projects with SQL, Tableau, Excel, and Python. For data analysts looking to level up their career and complete beginners looking to get started. No fluff. No theory. Just step-by-step tutorials anyone can follow.
Hey Reader, Quick question: Could a colleague open your most recent SQL query and understand what it does without asking you a single question? If the answer is "probably not," this newsletter is for you. Writing SQL that works is step one. Writing SQL that someone else can read, trust, and maintain โ that's the skill that changes how people see your work. Why This Matters More Than You Think Here's what I've noticed over 15+ years in analytics: the analysts who get promoted aren't always the...
Hey Reader, Imagine you're presenting a finding to your team: "Customer A spent $4,200 with us." The first question from the room: "Is that a lot?" Most analysts learning SQL don't realize that, without context, the number means nothing. You need comparison. Is the average customer spend $500 or $5,000? Is $4,200 in the top 10% or the middle of the pack? This is the "compared to what?" problem, and subqueries solve it elegantly. Numbers without context don't drive decisions. Executives don't...
Hello Reader, Almost every business question boils down to one of two things: "How many?" (COUNT) "How much?" (SUM) How many customers booked this month? How much revenue did we generate? How many trips were cancelled? How much did we lose? Once you're comfortable with COUNT and SUM, you can answer the majority of questions that come your way (like sales analytics using SQL). Let me show you both patterns using a real business scenario. The Scenario Your operations manager asks: "Give me a...