<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: TELL IVAN CASILLA MAQUERA</title>
    <description>The latest articles on DEV Community by TELL IVAN CASILLA MAQUERA (@ivancasillaaa).</description>
    <link>https://dev.to/ivancasillaaa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1437253%2F4b59e35b-2d54-427e-804b-bc0bdcd2ecc5.png</url>
      <title>DEV Community: TELL IVAN CASILLA MAQUERA</title>
      <link>https://dev.to/ivancasillaaa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ivancasillaaa"/>
    <language>en</language>
    <item>
      <title>Creating a Sales Analysis Application with Streamlit: A Practical Approach to Business Intelligence</title>
      <dc:creator>TELL IVAN CASILLA MAQUERA</dc:creator>
      <pubDate>Fri, 19 Apr 2024 22:11:56 +0000</pubDate>
      <link>https://dev.to/ivancasillaaa/creating-a-sales-analysis-application-with-streamlit-a-practical-approach-to-business-intelligence-1c4l</link>
      <guid>https://dev.to/ivancasillaaa/creating-a-sales-analysis-application-with-streamlit-a-practical-approach-to-business-intelligence-1c4l</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;br&gt;
Streamlit is a powerful open-source tool that allows you to create interactive web applications for data analysis and visualization with just a little Python code. In this article, we'll explore how to use Streamlit to build a sales analysis application, providing a practical approach to business intelligence. We'll learn how to generate sample data, visualize key information, create interactive charts, and deploy our application to the cloud.&lt;/p&gt;

&lt;p&gt;Setting up the Environment:&lt;br&gt;
To get started, we'll need to install the following Python libraries:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fosjbzv0mi4xznp2k9wpb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fosjbzv0mi4xznp2k9wpb.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;-Streamlit is the main library that will allow us to &lt;br&gt;
 create the web application.&lt;br&gt;
-Pandas will be used for data manipulation and &lt;br&gt;
 analysis.&lt;br&gt;
-Plotly will help us create attractive and &lt;br&gt;
 interactive data visualizations.&lt;/p&gt;

&lt;p&gt;Let's explore the code step by step:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr66daj8wcemcmks4xq3n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr66daj8wcemcmks4xq3n.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this section, we import the necessary libraries and generate a sample dataset using a Pandas DataFrame. This DataFrame contains information about different products, such as their name, category, sales, costs, and region.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkq8mp5rbtvxr59iuww5s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkq8mp5rbtvxr59iuww5s.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, we configure the Streamlit application page by setting a title and a "wide" layout to better utilize the available space. Then, we display the sales data in our application using st.header and st.write.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxaa53ohcths4btq8cah5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxaa53ohcths4btq8cah5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this section, we create an interactive bar chart that displays total sales by region. First, we group the data by region and sum the sales using Pandas. Then, we use the plotly.express library to create the chart and display it in our application with st.plotly_chart.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffg6i4ba1auxfoikwmmys.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffg6i4ba1auxfoikwmmys.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similarly, we create an interactive pie chart that shows the distribution of sales by product category.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4q5qake1czn4yrt912y5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4q5qake1czn4yrt912y5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, we display some key performance indicators (KPIs) important for a business, such as total sales, total cost, and net profit. We use st.columns to divide the screen into three columns and display a KPI in each one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Running the Application:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;To run the application locally, follow these steps:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.-Save the above code in a file called ejemplo.py.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F20wquu6y9igayzv0efz6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F20wquu6y9igayzv0efz6.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.-Open a terminal or command prompt and navigate to the directory &lt;br&gt;
 where app.py is located.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10vhxbvb8piqgk78qwhk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10vhxbvb8piqgk78qwhk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3.-Run the following command: streamlit run app.py.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6egeivkrdz3qk6r063f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6egeivkrdz3qk6r063f.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4.-The application will open in your local web browser, and you'll &lt;br&gt;
  be able to interact with the charts and explore the data from &lt;br&gt;
  different perspectives.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq1sdlh2kirgzenbumgep.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq1sdlh2kirgzenbumgep.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs0gtgx2pdgq7j8kek3e7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs0gtgx2pdgq7j8kek3e7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5lng3h8aa41lonbrzoax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5lng3h8aa41lonbrzoax.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawxtyb096zve5tlcjd98.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawxtyb096zve5tlcjd98.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deploying to Streamlit Cloud:&lt;/strong&gt;&lt;br&gt;
Streamlit Cloud is a service that allows us to deploy our Streamlit applications to the cloud effortlessly. To do so, follow these steps:&lt;/p&gt;

&lt;p&gt;1.-Create a repository on GitHub and upload the app.py file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjv5rvokpounycnzg4uix.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjv5rvokpounycnzg4uix.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.-Go to &lt;a href="https://streamlit.io" rel="noopener noreferrer"&gt;https://streamlit.io&lt;/a&gt;, log in, and create a new app from your GitHub repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwrryu6smjewsuwna9sbj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwrryu6smjewsuwna9sbj.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3.-Streamlit Cloud will deploy your application and provide you with a public URL to access it from anywhere.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://app-b8tbb4n9vpnghxjbnktkpm.streamlit.app/" rel="noopener noreferrer"&gt;https://app-b8tbb4n9vpnghxjbnktkpm.streamlit.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5u6ba1b978x9saia89gp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5u6ba1b978x9saia89gp.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fngt7qo62o34n0nr9wkck.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fngt7qo62o34n0nr9wkck.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6c38a1vb6mssrv2qdmah.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6c38a1vb6mssrv2qdmah.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next Steps:&lt;/strong&gt;&lt;br&gt;
This application is just a basic example, but you can improve and expand it in several ways, such as:&lt;/p&gt;

&lt;p&gt;-Loading real data from different sources (databases,CSV files, &lt;br&gt;
 APIs, etc.).&lt;br&gt;
-Adding more analyses and visualizations, such as line charts,scatter plots, heatmaps, etc.&lt;br&gt;
-Implementing data filtering and sorting functions.&lt;br&gt;
-Generating automatic reports in different formats (PDF, Excel, etc.).&lt;br&gt;
-Integrating user authentication and access control.&lt;/p&gt;

&lt;p&gt;The flexibility and potential of Streamlit are &lt;br&gt;
enormous, allowing you to create more complex and &lt;br&gt;
customized business intelligence applications based &lt;br&gt;
on your specific needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
In this article, we've explored how Streamlit can simplify the creation of interactive web applications for data analysis and business intelligence. We've built an application that analyzes sales data, displays key information through interactive charts and KPIs, and learned how to deploy it to the cloud using Streamlit Cloud.&lt;/p&gt;

&lt;p&gt;Streamlit is a powerful tool that combines ease of use with the ability to create complex applications. I encourage you to explore Streamlit and discover how it can help you transform your data into valuable information for decision-making in your business.&lt;/p&gt;

&lt;p&gt;I hope this article has been helpful and inspires you to begin your own journey with Streamlit. Enjoy creating interactive and attractive business intelligence applications!&lt;/p&gt;

</description>
      <category>streamlit</category>
      <category>python</category>
      <category>pandas</category>
      <category>plotyexpress</category>
    </item>
  </channel>
</rss>
