This Jupyter Notebook delves into the creation and analysis of synthetic climbing chalk sales data, specifically designed to simulate a one-year period from January 1st, 2015, to January 1st, 2016.
The data is generated using Python code and aims to represent the climbing gear industry. It encompasses five distinct customer profiles, three varied price points for the chalk, and incorporates three different ordering methods. This rich dataset provides a valuable platform for data exploration, analysis, and machine learning tasks relevant to the climbing gear industry.
By analyzing this synthetic data, we can gain valuable insights that might be challenging or expensive to obtain in the real world. This analysis will provide a controlled environment where we can simulate real-world scenarios and explore various aspects of climbing chalk sales.
The analysis will follow these steps:
Synthetic Data Creation: We'll begin by generating the synthetic sales data using Python code. This code will simulate a one-year period and incorporate the following elements:
Data Exploration: We'll examine the structure and content of the synthetic data to ensure it reflects realistic sales patterns. We'll verify the distribution of customer profiles, price points, and ordering methods.
Customer Cost Distribution: We'll analyze how cost is distributed across different customer profiles. This will involve creating histograms that visualize the frequency of purchases within various cost ranges for each customer profile.
Daily Sales Trend: We'll shift our focus to understanding how sales fluctuate over time. By calculating daily sales and creating a line plot, we'll investigate potential seasonal trends, peak sales periods, or any other patterns in daily sales figures.
Saving the DataFrame: Finally, we'll save the processed data as a CSV file for future reference or potential use in other tools. This will ensure easy access to the analyzed data for further exploration or sharing.
Throughout this process, we'll leverage the functionalities of pandas (pd) and matplotlib.pyplot (plt) libraries for data manipulation and visualization.
By following this structured approach, we'll gain valuable insights into the simulated sales data, allowing us to explore various aspects of the climbing gear industry and potentially use these insights to inform real-world sales strategies or develop machine learning models for sales prediction in this domain.
Let's begin our exploration of this synthetic climbing chalk sales data!
# Import all necessary packages and libraries
import random
from datetime import date, timedelta
import pandas as pd
The initial code sets the stage for simulating customer sales by defining: common first names (first_names), a year-long sales period (start_date & end_date), different chalk prices (chalk_costs), and potential purchase channels (order_type).
# Define the list of first names
first_names = ["Alice", "Bob", "Charlie", "Diana", "Evan"]
# Define the date range (start and end)
start_date = date(2015, 1, 1)
end_date = date(2016, 1, 1)
# Define the list of chalk bag costs
chalk_costs = [3, 5, 10]
order_type = ["Store", "Online", "Private"]
Following the initial setup, this code segment dives into generating the actual sales data. It defines a function generate_random_date to create random dates within the specified year range. Then, it constructs a dictionary (data) with columns for customer names, sale dates, costs, and sale types. Utilizing a loop, it iterates 100 times to populate the dictionary with random selections from the predefined lists (first_names, chalk_costs, and order_type) and the generated random dates. Finally, it converts the dictionary into a Pandas DataFrame (df) and prints it for initial inspection.