Building a Dashboard in Python

Sogbesan Teniloluwa
6 min readMar 4, 2023

--

Introduction

Have you ever shared your data analysis findings with a friend and they suggest a brilliant idea that completely changes the game? Well, that is exactly what happened to me while I was analyzing Hafat’s website sales performance.

My friend suggested that I make a single dashboard in Python with all of the plots from my exploratory data analysis. I was intrigued, so I decided to give it a try with Matplotlib, and to my surprise, I was able to create a beautiful dashboard that displays all of the important insights.

If you’re curious to know how I turned a bunch of plots into a cool dashboard with Python, keep reading!

Data Analysis Flow Chart

Background Study

Hafsat Signature Ventures is a promising fashion brand that focuses on creating handmade bags and fashion accessories that combine beauty with durability and functionality. Founded in 2019, the brand has quickly gained recognition for its unique designs and commitment to quality.

In January 2022, Hafsat Signature Ventures launched its ecommerce website hafsatsignature.com, providing customers with a convenient platform to purchase their products online.

Using Python-based visualization tools, I analyzed the sales performance for Hafsat Signature from January to December 2022, providing insights into customer behavior, product performance, and marketing strategies.

Data Gathering

The website lacked analytical tools for tracking key metrics such as pageviews, unique visitors, bounce rate, time on site, exit pages, devices used, and site search. As a result, data for this analysis was gathered by manually downloading CSV reports from the website’s backend. These reports included useful data such as product sales, customer information, and purchase dates. The data was then imported into a Jupyter Notebook to begin the data analysis and cleaning process using Python programming.

Data Wrangling

This analysis was carried out using two datasets: a customer dataset with 21 rows and 16 columns and a product sales dataset with 24 rows and 4 columns. The data wrangling process consisted of two major steps: first, assessing the data, and second, cleaning the data.

Here is a preview of one of the dataset:

To ensure the protection of customer privacy, a preview of the customer dataset will not be provided.

Assesing the Data: The datasets were assessed for data quality and tidiness issues using a combination of visual and programmatic methods, including df.info(), df.columns, df.shape, and df.head() commands.

Data Cleaning: After assessing the data, I discovered some data quality issues in the datasets and the steps below outline the cleaning process.

  1. Renamed the columns to ensure clarity and accuracy.
  2. Changed the data type of the date column to a datetime object for easier manipulation and analysis.
  3. Created a month column to allow for easy grouping and aggregation of sales data.
  4. Replaced negative values in the net sales column with zero to correct any errors and ensure data accuracy.
  5. Dropped columns that were deemed irrelevant to the analysis to streamline the data and focus on the most pertinent information.

The full documentation of the data wrangling process, including the steps taken and the code used, can be found on my GitHub Repository.

Exploratory Data Analysis

With the datasets cleaned and prepared, I explored the data and asked several questions to gain insights into the sales performance of Hafsat’s e-commerce website. The questions asked were:

  1. What is the total number of net sales by gender?
  2. Which age group of customers had the highest number of sales?
  3. What is the customer conversion rate?
  4. Which months had the highest sales?
  5. Which products had the most sales?
  6. What were the top five bags with the highest sales?
  7. What was the total number of bags sold per month?
  8. What was the website’s most popular traffic source?

The exploratory data analysis process was extensively documented on my GitHub repository, including visualizations and statistical analyses to answer the questions posed above.

Data Visualization using Python

In this next step, I used Python to translate the insights obtained from the EDA process into visual representations that make it easier to communicate my findings and here is a snippet of code.

You can find the remaining code for the data visualization on my GitHub repository.

Insights

  • Males made more purchases than females.
  • The majority of customers fall within the age group of 15–30.
  • Only 4.8% of customers are returning customers.
  • There were no sales in April, May, August, and November, and relatively low sales in February and March.
  • Paid ads and social media are the most effective sources of traffic.
  • Adeola maxi, Kemi asooke, and Classic Laptop were the best-selling products, and they were also the most popular.

Recommendations

  • Focus on attracting more male customers by implementing targeted marketing strategies and conducting market research to understand their preferences and needs. This will allow Hafsat to design bags that cater to these preferences and better meet their needs.
  • Develop products and marketing strategies that appeal to the younger demographic (ages 15–30) by creating vibrant and trendy designs, affordable prices, influencer marketing, Instagram ads, and TikTok campaigns.
  • Improve customer retention by implementing customer retention strategies such as loyalty programs, personalized offers, and exceptional customer service. Collect feedback from customers to identify areas for improvement.
  • Identify and address sales patterns by analyzing reasons behind fluctuations in sales throughout the year and making adjustments to production schedules, increasing promotional efforts during slow months, or analyzing trends in consumer behavior during specific times of the year.
  • Hafsat can optimize their traffic sources by identifying successful campaigns, refining targeting strategies, and increasing ad spend on channels like paid ads and social media. Additionally, they could explore other potential traffic sources such as influencer marketing, email marketing, or affiliate marketing to drive more traffic to the website.
  • Focus on top-selling products by creating more variations, expanding product lines, and creating effective marketing campaigns around them to increase sales.

Conclusion

After analyzing Hafsat Signature’s website, it became clear that the lack of analytical tools on the website was a hindrance to tracking key metrics that could have provided further insights on sales performance. However, following my recommendations, Google Analytics has been installed on the website, which opens up new opportunities for analysis. I look forward to conducting another analysis with a broader range of metrics in place to uncover even more insights.

Overall, this experience has been both challenging and exciting, and I’m grateful to Hafsat for the opportunity to work with them and share my findings with the public. The analysis revealed that the website has a lot of room for growth, and if you’re in the market for high-quality bags, I highly recommend checking out hafsatsignature.com. Their products are beautiful and unique, and you’re sure to find something you’ll love. Thank you for taking the time to read this article, and happy shopping!

I’m always happy to connect with new people! You can reach me at Sogbesan Teni or find me on Twitter and say hi.

--

--