This project focuses on analyzing retail store inventory data to develop a Dynamic Pricing Strategy. The goal is to optimize pricing decisions, forecast demand, and maximize revenue using data-driven insights. The analysis includes demand trend exploration, competitor pricing impact, discount strategies, and revenue maximization simulations.
Importing Required Libraries
KaggleHub: For loading datasets directly from Kaggle.
NumPy: For numerical computations.
Pandas: For data manipulation and analysis.
Plotly: For creating interactive visualizations.
Scikit-learn: For machine learning tasks, including regression modeling.
Dataset Overview
The dataset, sourced from Kaggle, contains detailed information about retail store inventory, including:
Columns: Price, Competitor Pricing, Discount, Demand Forecast, etc.
Size: 73,100 rows and 21 columns.
Integrity: No missing or duplicate values.
Data Wrangling
Convert Date Column: The Date column was converted to a datetime format for time-based analysis.
Calculate Revenue: A new column Revenue was created using the formula:
Revenue = (Price - (Price * Discount / 100)) * Units Sold
Inspect Data: Ensured transformations were applied correctly.
Analyzing Demand Trends
Daily Demand Trends: Grouped data by date to calculate total daily demand. Visualized using a line chart to identify fluctuations and seasonality.
Weekly and Monthly Trends: Added Week and Month columns for granular analysis. Weekly and monthly demand trends were visualized using bar charts.
Findings
Daily Trends: Peaks observed during holidays and promotional periods.
Weekly Trends: Week 52 showed the highest demand, likely due to year-end promotions.
Monthly Trends: July exhibited the highest demand, indicating mid-year activity.
Competitor Pricing Impact
Correlation Analysis: Analyzed the relationship between Competitor Pricing and Demand Forecast.
Scatter Plot: Visualized how demand varies with competitor pricing.
Price Difference Analysis: Calculated the difference between Price and Competitor Pricing and analyzed its impact on demand.
Findings
A strong correlation between competitor pricing and demand was observed. Competitive pricing strategies are crucial for maintaining market share.
Discount Strategies
Correlation Analysis: Analyzed the relationship between Discount and Demand Forecast.
Box Plot: Visualized demand distribution across different discount levels.
Revenue Simulation: Calculated revenue for each discount level and visualized average revenue by discount level using a bar chart.
Findings
Discounts positively impact demand, but excessive discounts reduce revenue. Optimal discount levels were identified to maximize revenue.
Pricing Model
Data Preparation: Selected Price, Competitor Pricing, and Discount as features. Used Demand Forecast as the target variable.
Train-Test Split: Split data into training (80%) and testing (20%) sets.
Model Training: Trained a linear regression model.
Evaluation: Achieved reasonable accuracy with an R² score of 0.85.