Now that we have our development environment properly configured, we're ready to navigate to the Notebook2 directory and launch our application. This is where our data visualization project will come to life. First, we'll need to change directories from our main project folder into the Notebook2 subdirectory using the cd command.
Your command prompt should now display "Notebook2" on Unix-based systems, or show the full directory path ending with "Notebook2" on Windows machines. With our working directory properly set, we can execute python app.py to start our Dash development server. The server will generate a local URL—typically http://127.0.0.1:8050—which you should copy and paste into your preferred web browser to view the application.
When you see "Hello Dash" displayed in your browser, you'll know the server initialization was successful and all components are functioning correctly. This simple message confirms that our Flask-based Dash application is running smoothly and ready for development.
Let's return to Visual Studio Code to enhance our application with the data processing functionality we developed earlier. We've already imported the essential libraries for our project: Dash for the web framework, HTML components for layout structure, Plotly Express for interactive visualizations, and Pandas for robust data manipulation. These form the foundation of any professional data dashboard built in 2026.
To maintain clean, readable code architecture, I recommend adding organizational comments to separate different functional sections. Above our existing server configuration code, let's add a "DATA CODE" section comment to clearly delineate where our data processing logic begins.
In this data section, we'll implement the CSV import functionality to load our Chipotle dataset. Using Pandas' read_csv() method, we'll import the "chipotle.csv" file into a DataFrame called ordered_items. To verify our data loaded correctly during development, we can temporarily add a print statement to display a preview of our DataFrame structure and contents.
Excellent! The terminal output shows a clean tabular view of our dataset, confirming that the CSV import executed successfully. This gives us confidence that our data pipeline is functioning as expected.
Remember to remove the print statement once you've verified the data import—it's not needed in production and can clutter your server logs unnecessarily.
Next, we need to address a common data cleaning challenge: converting price strings to numerical values for mathematical operations. The original dataset stores prices as strings with dollar signs (e.g., "$8.75"), but we need float values for aggregation and analysis. We'll create a new column called item_price_as_number by applying a lambda function to the existing price column.
Our transformation logic uses ordered_items['item_price_as_number'] = ordered_items['item_price'].apply(lambda price: float(price.strip('$'))). This elegant one-liner removes the dollar sign and converts each price to a float data type, enabling proper numerical calculations downstream.
Perfect! When we examine our updated DataFrame, we can see the new numerical column has been successfully created, with values that are clearly formatted as numbers rather than strings.
Now we can perform meaningful financial analysis on our dataset. Let's calculate total revenue by menu item using Pandas' powerful groupby functionality.
We'll group our data by item name and aggregate the numerical price column using the sum function: revenues = ordered_items.groupby('item_name')['item_price_as_number'].sum(). This creates a Series showing total revenue generated by each menu item across all orders in our dataset.
The revenue calculations match our previous notebook analysis perfectly, demonstrating consistency in our data processing pipeline across different development environments.
For dashboard clarity and visual impact, we'll focus on the top-performing items rather than displaying the entire dataset. Let's extract the five highest-revenue items using the nlargest(5) method, which provides a clean, sorted view of our most important data points.
Excellent! Our top five revenue generators are now properly identified and ranked, providing the foundation for compelling data visualizations that will drive business insights.
With our data processing pipeline complete and verified, we're ready to transition into the visualization phase of our project. In the next section, we'll create interactive Plotly figures that transform these revenue insights into engaging, professional charts suitable for executive dashboards and business presentations.
We'll develop multiple complementary visualizations to present our findings from different analytical perspectives, then integrate them seamlessly into our Dash application framework. This multi-chart approach ensures stakeholders can quickly grasp both high-level trends and detailed insights from our Chipotle revenue analysis.