Connect with us

Jobs & Careers

How to Combine Streamlit, Pandas, and Plotly for Interactive Data Apps

Published

on


How to Combine Streamlit, Pandas, and Plotly for Interactive Data Apps
Image by Author | ChatGPT

 

Introduction

 
Creating interactive web-based data dashboards in Python is easier than ever when you combine the strengths of Streamlit, Pandas, and Plotly. These three libraries work seamlessly together to transform static datasets into responsive, visually engaging applications — all without needing a background in web development.

However, there’s an important architectural difference to understand before we begin. Unlike libraries such as matplotlib or seaborn that work directly in Jupyter notebooks, Streamlit creates standalone web applications that must be run from the command line. You’ll write your code in a text-based IDE like VS Code, save it as a .py file, and run it using streamlit run filename.py. This shift from the notebook environment to script-based development opens up new possibilities for sharing and deploying your data applications.

In this hands-on tutorial, you’ll learn how to build a complete sales dashboard in two clear steps. We’ll start with core functionality using just Streamlit and Pandas, then enhance the dashboard with interactive visualizations using Plotly.

 

Setup

 
Install the required packages:

pip install streamlit pandas plotly

 

Create a new folder for your project and open it in VS Code (or your preferred text editor).

 

Step 1: Streamlit + Pandas Dashboard

 
Let’s start by building a functional dashboard using just Streamlit and Pandas. This demonstrates how Streamlit creates interactive web interfaces and how Pandas handles data filtering.

Create a file called step1_dashboard_basic.py:

import streamlit as st
import pandas as pd
import numpy as np

# Page config
st.set_page_config(page_title="Basic Sales Dashboard", layout="wide")

# Generate sample data
np.random.seed(42)
df = pd.DataFrame({
    'Date': pd.date_range('2024-01-01', periods=100),
    'Sales': np.random.randint(500, 2000, size=100),
    'Region': np.random.choice(['North', 'South', 'East', 'West'], size=100),
    'Product': np.random.choice(['Product A', 'Product B', 'Product C'], size=100)
})

# Sidebar filters
st.sidebar.title('Filters')
regions = st.sidebar.multiselect('Select Region', df['Region'].unique(), default=df['Region'].unique())
products = st.sidebar.multiselect('Select Product', df['Product'].unique(), default=df['Product'].unique())

# Filter data
filtered_df = df[(df['Region'].isin(regions)) & (df['Product'].isin(products))]

# Display metrics
col1, col2, col3 = st.columns(3)
col1.metric("Total Sales", f"${filtered_df['Sales'].sum():,}")
col2.metric("Average Sales", f"${filtered_df['Sales'].mean():.0f}")
col3.metric("Records", len(filtered_df))

# Display filtered data
st.subheader("Filtered Data")
st.dataframe(filtered_df)

 

Let’s break down the key Streamlit methods used here:

  • st.set_page_config() configures the browser tab title and layout
  • st.sidebar creates the left navigation panel for filters
  • st.multiselect() generates dropdown menus for user selections
  • st.columns() creates side-by-side layout sections
  • st.metric() displays large numbers with labels
  • st.dataframe() renders interactive data tables

These methods automatically handle user interactions and trigger app updates when selections change.

Run this from your terminal (or VS Code’s integrated terminal):

streamlit run step1_dashboard_basic.py

 

Your browser will open to http://localhost:8501 showing an interactive dashboard.

 
How to Combine Streamlit, Pandas, and Plotly for Interactive Data Apps
 

Try changing the filters in the sidebar — watch how the metrics and data table update automatically! This demonstrates the reactive nature of Streamlit combined with Pandas’ data manipulation capabilities.

 

Step 2: Add Plotly for Interactive Visualizations

 
Now let’s enhance our dashboard by adding Plotly’s interactive charts. This shows how all three libraries work together seamlessly. Let’s create a new file and call it step2_dashboard_plotly.py:

import streamlit as st
import pandas as pd
import plotly.express as px
import numpy as np

# Page config
st.set_page_config(page_title="Sales Dashboard with Plotly", layout="wide")

# Generate data
np.random.seed(42)
df = pd.DataFrame({
    'Date': pd.date_range('2024-01-01', periods=100),
    'Sales': np.random.randint(500, 2000, size=100),
    'Region': np.random.choice(['North', 'South', 'East', 'West'], size=100),
    'Product': np.random.choice(['Product A', 'Product B', 'Product C'], size=100)
})

# Sidebar filters
st.sidebar.title('Filters')
regions = st.sidebar.multiselect('Select Region', df['Region'].unique(), default=df['Region'].unique())
products = st.sidebar.multiselect('Select Product', df['Product'].unique(), default=df['Product'].unique())

# Filter data
filtered_df = df[(df['Region'].isin(regions)) & (df['Product'].isin(products))]

# Metrics
col1, col2, col3 = st.columns(3)
col1.metric("Total Sales", f"${filtered_df['Sales'].sum():,}")
col2.metric("Average Sales", f"${filtered_df['Sales'].mean():.0f}")
col3.metric("Records", len(filtered_df))

# Charts
col1, col2 = st.columns(2)

with col1:
    fig_line = px.line(filtered_df, x='Date', y='Sales', color="Region", title="Sales Over Time")
    st.plotly_chart(fig_line, use_container_width=True)

with col2:
    region_sales = filtered_df.groupby('Region')['Sales'].sum().reset_index()
    fig_bar = px.bar(region_sales, x='Region', y='Sales', title="Total Sales by Region")
    st.plotly_chart(fig_bar, use_container_width=True)

# Data table
st.subheader("Filtered Data")
st.dataframe(filtered_df)

 

Run this from your terminal (or VS Code’s integrated terminal):

streamlit run step2_dashboard_plotly.py

 

Now you have a complete interactive dashboard!

 
How to Combine Streamlit, Pandas, and Plotly for Interactive Data Apps
 

The Plotly charts are fully interactive — you can hover over data points, zoom in on specific time periods, and even click legend items to show/hide data series.

 

How the Three Libraries Work Together

 
This combination is powerful because each library handles what it does best:

Pandas manages all data operations:

  • Creating and loading datasets
  • Filtering data based on user selections
  • Aggregating data for visualizations
  • Handling data transformations

Streamlit provides the web interface:

  • Creates interactive widgets (multiselect, sliders, etc.)
  • Automatically reruns the entire app when users interact with widgets
  • Handles the reactive programming model
  • Manages layout with columns and containers

Plotly creates rich, interactive visualizations:

  • Charts that users can hover, zoom, and explore
  • Professional-looking graphs with minimal code
  • Automatic integration with Streamlit’s reactivity

 

Key Development Workflow

 
The development process follows a straightforward pattern. Start by writing your code in VS Code or any text editor, saving it as a .py file. Next, run the application from your terminal using streamlit run filename.py, which opens your dashboard in a browser at http://localhost:8501. As you edit and save your code, Streamlit automatically detects changes and offers to rerun the application. Once you’re satisfied with your dashboard, you can deploy it using Streamlit Community Cloud to share with others.

 

Next Steps

 
Try these enhancements:

Add real data:

# Replace sample data with CSV upload
uploaded_file = st.sidebar.file_uploader("Upload CSV", type="csv")
if uploaded_file:
    df = pd.read_csv(uploaded_file)

 

Keep in mind that real datasets will require preprocessing steps specific to your data structure. You’ll need to adjust column names, handle missing values, and modify the filter options to match your actual data fields. The sample code provides a template, but each dataset will have unique requirements for cleaning and preparation.

More chart types:

# Pie chart for product distribution
fig_pie = px.pie(filtered_df, values="Sales", names="Product", title="Sales by Product")
st.plotly_chart(fig_pie)

 

You can leverage an entire gallery of Plotly’s graphing capabilities.

 

Deploying Your Dashboard

 
Once your dashboard is working locally, sharing it with others is straightforward through Streamlit Community Cloud. First, push your code to a public GitHub repository, making sure to include a requirements.txt file listing your dependencies (streamlit, pandas, plotly). Then visit https://streamlit.io/cloud, sign in with your GitHub account, and select your repository. Streamlit will automatically build and deploy your app, providing a public URL that anyone can access. The free tier supports multiple apps and handles reasonable traffic loads, making it perfect for sharing dashboards with colleagues or showcasing your work in a portfolio.

 

Conclusion

 
The combination of Streamlit, Pandas, and Plotly transforms data analysis from static reports into interactive web applications. With just two Python files and a handful of methods, you’ve built a complete dashboard that rivals expensive business intelligence tools.

This tutorial demonstrates a significant shift in how data scientists can share their work. Instead of sending static charts or requiring colleagues to run Jupyter notebooks, you can now create web applications that anyone can use through a browser. The transition from notebook-based analysis to script-based applications opens new opportunities for data professionals to make their insights more accessible and impactful.

As you continue building with these tools, consider how interactive dashboards can replace traditional reporting in your organization. The same principles you’ve learned here scale to handle real datasets, complex calculations, and sophisticated visualizations. Whether you’re creating executive dashboards, exploratory data tools, or client-facing applications, this three-library combination provides a solid foundation for professional data applications.
 
 

Born in India and raised in Japan, Vinod brings a global perspective to data science and machine learning education. He bridges the gap between emerging AI technologies and practical implementation for working professionals. Vinod focuses on creating accessible learning pathways for complex topics like agentic AI, performance optimization, and AI engineering. He focuses on practical machine learning implementations and mentoring the next generation of data professionals through live sessions and personalized guidance.



Source link

Continue Reading
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Jobs & Careers

NVIDIA Reveals Two Customers Accounted for 39% of Quarterly Revenue

Published

on



NVIDIA disclosed on August 28, 2025, that two unnamed customers contributed 39% of its revenue in the July quarter, raising questions about the chipmaker’s dependence on a small group of clients.

The company posted record quarterly revenue of $46.7 billion, up 56% from a year ago, driven by insatiable demand for its data centre products.

In a filing with the U.S. Securities and Exchange Commission (SEC), NVIDIA said “Customer A” accounted for 23% of total revenue and “Customer B” for 16%. A year earlier, its top two customers made up 14% and 11% of revenue.

The concentration highlights the role of large buyers, many of whom are cloud service providers. “Large cloud service providers made up about 50% of the company’s data center revenue,” NVIDIA chief financial officer Colette Kress said on Wednesday. Data center sales represented 88% of NVIDIA’s overall revenue in the second quarter.

“We have experienced periods where we receive a significant amount of our revenue from a limited number of customers, and this trend may continue,” the company wrote in the filing.

One of the customers could possibly be Saudi Arabia’s AI firm Humain, which is building two data centers in Riyadh and Dammam, slated to open in early 2026. The company has secured approval to import 18,000 NVIDIA AI chips.

The second customer could be OpenAI or one of the major cloud providers — Microsoft, AWS, Google Cloud, or Oracle. Another possibility is xAI.

Previously, Elon Musk said xAI has 230,000 GPUs, including 30,000 GB200s, operational for training its Grok model in a supercluster called Colossus 1. Inference is handled by external cloud providers. 

Musk added that Colossus 2, which will host an additional 550,000 GB200 and GB300 GPUs, will begin going online in the coming weeks. “As Jensen Huang has stated, xAI is unmatched in speed. It’s not even close,” Musk wrote in a post on X.Meanwhile, OpenAI is preparing for a major expansion. Chief Financial Officer Sarah Friar said the company plans to invest in trillion-dollar-scale data centers to meet surging demand for AI computation.

The post NVIDIA Reveals Two Customers Accounted for 39% of Quarterly Revenue appeared first on Analytics India Magazine.



Source link

Continue Reading

Jobs & Careers

‘Reliance Intelligence’ is Here, In Partnership with Google and Meta 

Published

on



Reliance Industries chairman Mukesh Ambani has announced the launch of Reliance Intelligence, a new wholly owned subsidiary focused on artificial intelligence, marking what he described as the company’s “next transformation into a deep-tech enterprise.”

Addressing shareholders, Ambani said Reliance Intelligence had been conceived with four core missions—building gigawatt-scale AI-ready data centres powered by green energy, forging global partnerships to strengthen India’s AI ecosystem, delivering AI services for consumers and SMEs in critical sectors such as education, healthcare, and agriculture, and creating a home for world-class AI talent.

Work has already begun on gigawatt-scale AI data centres in Jamnagar, Ambani said, adding that they would be rolled out in phases in line with India’s growing needs. 

These facilities, powered by Reliance’s new energy ecosystem, will be purpose-built for AI training and inference at a national scale.

Ambani also announced a “deeper, holistic partnership” with Google, aimed at accelerating AI adoption across Reliance businesses. 

“We are marrying Reliance’s proven capability to build world-class assets and execute at India scale with Google’s leading cloud and AI technologies,” Ambani said.

Google CEO Sundar Pichai, in a recorded message, said the two companies would set up a new cloud region in Jamnagar dedicated to Reliance.

“It will bring world-class AI and compute from Google Cloud, powered by clean energy from Reliance and connected by Jio’s advanced network,” Pichai said. 

He added that Google Cloud would remain Reliance’s largest public cloud partner, supporting mission-critical workloads and co-developing advanced AI initiatives.

Ambani further unveiled a new AI-focused joint venture with Meta. 

He said the venture would combine Reliance’s domain expertise across industries with Meta’s open-source AI models and tools to deliver “sovereign, enterprise-ready AI for India.”

Meta founder and CEO Mark Zuckerberg, in his remarks, said the partnership is aimed to bring open-source AI to Indian businesses at scale. 

“With Reliance’s reach and scale, we can bring this to every corner of India. This venture will become a model for how AI, and one day superintelligence, can be delivered,” Zuckerberg said.

Ambani also highlighted Reliance’s investments in AI-powered robotics, particularly humanoid robotics, which he said could transform manufacturing, supply chains and healthcare. 

“Intelligent automation will create new industries, new jobs and new opportunities for India’s youth,” he told shareholders.

Calling AI an opportunity “as large, if not larger” than Reliance’s digital services push a decade ago, Ambani said Reliance Intelligence would work to deliver “AI everywhere and for every Indian.”

“We are building for the next decade with confidence and ambition,” he said, underscoring that the company’s partnerships, green infrastructure and India-first governance approach would be central to this strategy.

The post ‘Reliance Intelligence’ is Here, In Partnership with Google and Meta  appeared first on Analytics India Magazine.



Source link

Continue Reading

Jobs & Careers

Cognizant, Workfabric AI to Train 1,000 Context Engineers

Published

on


Cognizant has announced that it would deploy 1,000 context engineers over the next year to industrialise agentic AI across enterprises.

According to an official release, the company claimed that the move marks a “pivotal investment” in the emerging discipline of context engineering. 

As part of this initiative, Cognizant said it is partnering with Workfabric AI, the company building the context engine for enterprise AI. 

Cognizant’s context engineers will be powered by Workfabric AI’s ContextFabric platform, the statement said, adding that the platform transforms the organisational DNA of enterprises, how their teams work, including their workflows, data, rules, and processes, into actionable context for AI agents.Context engineering is essential to enabling AI a

Subscribe or log in to Continue Reading

Uncompromising innovation. Timeless influence. Your support powers the future of independent tech journalism.

Already have an account? Sign In.



Source link

Continue Reading

Trending