Phase 3
Phase 3
visualisation
Introduction
In this analysis, we will explore the power of data
visualization in dynamic pricing, using interactive and dynamic
visualizations to bring data to life and drive business
success.Uncover insights into dynamic pricing with data
visualization. Using Python and popular libraries, we’ll create
interactive visualizations to explore key metrics and trends, bringing
dynamic pricing data to life
Objective
• Identify patterns and trends
• Visualize demand curves
• Analyze price elasticity
• Compare pricing scenarios
• Highlight peak demand periods
Df = pd.DataFrame({
‘date’: dates,
‘price’: prices,
‘demand’: demand,
‘competitor_price’: competitor_prices
})
# Pair plot
Sns.pairplot(df[[‘price’, ‘demand’, ‘competitor_price’]])
Plt.suptitle(‘Pair Plot of Price, Demand, and Competitor Price’,
y=1.02)
Plt.show()
# Heatmap
Plt.figure(figsize=(8, 6))
Sns.heatmap(df.corr(), annot=True, cmap=’coolwarm’, vmin=-1,
vmax=1)
Plt.title(‘Correlation between Price, Demand, and Competitor Price’)
Plt.show()
# Joint plot
Sns.jointplot(data=df, x=’price’, y=’demand’, kind=’reg’)
Plt.suptitle(‘Joint Plot of Price vs Demand’, y=1.02)
Plt.show()
Output
Interactive visualisation
It will create an interactive scatter plot using Plotly, where you
can hover over each data point to see additional information like
date and competitor price. You can pan, zoom, and interact with the
plot dynamically.
Program code
Import pandas as pd
Import numpy as np
Import plotly.express as px
# Generate sample data
Np.random.seed(42)
Dates = pd.date_range(start=’2023-01-01’, periods=100, freq=’D’)
Prices = np.random.uniform(low=50, high=150, size=100)
Demand = np.random.uniform(low=20, high=100, size=100) + 0.1 *
(prices – 100)
Competitor_prices = prices * np.random.uniform(low=0.8, high=1.2,
size=100)
Df = pd.DataFrame({
‘date’: dates,
‘price’: prices,
‘demand’: demand,
‘competitor_price’: competitor_prices
})
Df = pd.DataFrame({
‘date’: dates,
‘price’: prices,
‘demand’: demand,
‘competitor_price’: competitor_prices
})
# Initialize the Dash app
App = dash.Dash(__name__)
# Define the layout of the dashboard
App.layout = html.Div([
Html.H1(“Dynamic Pricing Dashboard”),
dcc.Graph(id=’scatter-plot’),
dcc.Graph(id=’line-plot’),
])
# Define callback functions to update the plots based on user
interactions
@app.callback(
[dash.dependencies.Output(‘scatter-plot’, ‘figure’),
Dash.dependencies.Output(‘line-plot’, ‘figure’)],
[dash.dependencies.Input(‘scatter-plot’, ‘hoverData’)]
)
Def update_plots(hoverData):
# Get the selected point from the scatter plot
If hoverData is not None:
Selected_date = hoverData[‘points’][0][‘x’]
Selected_data = df[df[‘date’] == selected_date]
# Create scatter plot
Scatter_fig = px.scatter(selected_data, x=’price’, y=’demand’,
title=’Price vs Demand’)
# Create line plot
Line_fig = px.line(selected_data, x=’date’, y=’price’, title=’Price
Over Time’)
Assumed scenario
Conclusion
Data visualization techniques uncover insights in dynamic
pricing data, enabling FashionForward to optimize prices, maximize
revenue, and stay competitive.