@@ -43,6 +43,52 @@ waterfall_plot(
43
43
)
44
44
```
45
45
46
+ ### Index Plots
47
+
48
+ <div class =" clear " markdown >
49
+
50
+ ![ Image title] ( assets/images/analysis_modules/index_plot.svg ) { align=right loading=lazy width="50%"}
51
+
52
+ Index plots are visual tools used in retail analytics to compare different categories or segments against a baseline or
53
+ average value, typically set at 100. Index plots allow analysts to:
54
+
55
+ Quickly identify which categories over- or underperform relative to the average
56
+ Compare performance across diverse categories on a standardized scale
57
+ Highlight areas of opportunity or concern in retail operations
58
+ Easily communicate relative performance to stakeholders without revealing sensitive absolute numbers
59
+
60
+ In retail contexts, index plots are valuable for:
61
+
62
+ Comparing sales performance across product categories
63
+ Analyzing customer segment behavior against the overall average
64
+ Evaluating store or regional performance relative to company-wide metrics
65
+ Identifying high-potential areas for growth or investment
66
+
67
+ By normalizing data to an index, these plots facilitate meaningful comparisons and help focus attention on significant
68
+ deviations from expected performance, supporting more informed decision-making in retail strategy and operations.
69
+
70
+ </div >
71
+
72
+ Example:
73
+
74
+ ``` python
75
+ from pyretailscience.standard_graphs import index_plot
76
+
77
+ index_plot(
78
+ df,
79
+ df_index_filter = df[" segment_name" ] == " Light" ,
80
+ value_col = " unit_price" ,
81
+ group_col = " category_0_name" ,
82
+ title = " Music an opportunity category for Light?" ,
83
+ y_label = " Categories" ,
84
+ x_label = " Indexed Spend" ,
85
+ source_text = " Source: Transaction data financial year 2023" ,
86
+ sort_by = " value" ,
87
+ sort_order = " descending" ,
88
+ legend_title = " Quarter" ,
89
+ )
90
+ ```
91
+
46
92
### Timeline Plot
47
93
48
94
<div class =" clear " markdown >
@@ -73,8 +119,12 @@ from pyretailscience.standard_graphs import time_plot
73
119
rng = np.random.default_rng(42 )
74
120
df = pd.DataFrame(
75
121
{
76
- " transaction_datetime" : pd.concat([pd.Series(pd.date_range(start = " 2022-01-01" , periods = 200 , freq = " D" ))] * 3 ),
77
- " total_price" : np.concatenate([rng.integers(1 , 1000 , size = 200 ) * multiplier for multiplier in range (1 , 4 )]),
122
+ " transaction_datetime" : pd.concat(
123
+ [pd.Series(pd.date_range(start = " 2022-01-01" , periods = 200 , freq = " D" ))] * 3
124
+ ),
125
+ " total_price" : np.concatenate(
126
+ [rng.integers(1 , 1000 , size = 200 ) * multiplier for multiplier in range (1 , 4 )]
127
+ ),
78
128
" group" : [" Group A" ] * 200 + [" Group B" ] * 200 + [" Group C" ] * 200 ,
79
129
},
80
130
)
@@ -149,3 +199,190 @@ pa.df.head()
149
199
| 100 Animals Book | 4-Series 4K UHD | 78 | 82 | 1 | 0.000039 | 0.0128205 | 3.98 |
150
200
| 100 Animals Book | 700S Eterna Trumpet | 78 | 71 | 1 | 0.000039 | 0.0128205 | 4.60 |
151
201
<!-- markdownlint-enable MD013 -->
202
+
203
+ ### Cross Shop
204
+
205
+ <div class =" clear " markdown >
206
+
207
+ ![ Image title] ( https://placehold.co/600x400/EEE/31343C ) { align=right loading=lazy width="50%"}
208
+
209
+ PASTE TEXT HERE
210
+
211
+ </div >
212
+
213
+ Example:
214
+
215
+ ``` python
216
+ PASTE CODE HERE
217
+ ```
218
+
219
+ ### Gain Loss
220
+
221
+ <div class =" clear " markdown >
222
+
223
+ ![ Image title] ( https://placehold.co/600x400/EEE/31343C ) { align=right loading=lazy width="50%"}
224
+
225
+ PASTE TEXT HERE
226
+
227
+ </div >
228
+
229
+ Example:
230
+
231
+ ``` python
232
+ PASTE CODE HERE
233
+ ```
234
+
235
+ ### Customer Decision Hierarchy
236
+
237
+ <div class =" clear " markdown >
238
+
239
+ ![ Image title] ( assets/images/analysis_modules/customer_decision_hierarchy.svg ) { align=right loading=lazy width="50%"}
240
+
241
+ A Customer Decision Hierarchy (CDH), also known as a Customer Decision Tree, is a powerful tool in retail analytics that
242
+ visually represents the sequential steps and criteria customers use when making purchase decisions within a specific
243
+ product category. Here's a brief summary of its purpose and utility:
244
+
245
+ CDHs allow analysts to:
246
+
247
+ - Map out the hierarchical structure of customer decision-making processes
248
+ - Identify key product attributes that drive purchase decisions
249
+ - Understand product substitutions and alternatives customers consider
250
+ - Prioritize product attributes based on their importance to customers
251
+
252
+ In retail contexts, CDHs are valuable for:
253
+
254
+ - Optimizing product assortments and shelf layouts
255
+ - Developing targeted marketing strategies
256
+ - Identifying opportunities for new product development
257
+ - Understanding competitive dynamics within a category
258
+
259
+ By visualizing the decision-making process, CDHs help retailers align their offerings and strategies with customer
260
+ preferences, potentially increasing sales and customer satisfaction. They provide insights into how customers navigate
261
+ choices, enabling more effective category management and merchandising decisions.
262
+
263
+ </div >
264
+
265
+ Example:
266
+
267
+ ``` python
268
+ from pyretailscience.range_planning import CustomerDecisionHierarchy
269
+
270
+ cdh = CustomerDecisionHierarchy(df)
271
+ ax = cdh.plot(
272
+ orientation = " right" ,
273
+ source_text = " Source: Transactions 2024" ,
274
+ title = " Snack Food Substitutions" ,
275
+ )
276
+ ```
277
+
278
+ ### Revenue Tree
279
+
280
+ <div class =" clear " markdown >
281
+
282
+ ![ Image title] ( https://placehold.co/600x400/EEE/31343C ) { align=right loading=lazy width="50%"}
283
+
284
+ PASTE TEXT HERE
285
+
286
+ </div >
287
+
288
+ Example:
289
+
290
+ ``` python
291
+ PASTE CODE HERE
292
+ ```
293
+
294
+ ### HML Segmentation
295
+
296
+ <div class =" clear " markdown >
297
+
298
+ ![ Image title] ( https://placehold.co/600x400/EEE/31343C ) { align=right loading=lazy width="50%"}
299
+
300
+ PASTE TEXT HERE
301
+
302
+ </div >
303
+
304
+ Example:
305
+
306
+ ``` python
307
+ PASTE CODE HERE
308
+ ```
309
+
310
+ ### Threshold Segmentation
311
+
312
+ <div class =" clear " markdown >
313
+
314
+ ![ Image title] ( https://placehold.co/600x400/EEE/31343C ) { align=right loading=lazy width="50%"}
315
+
316
+ PASTE TEXT HERE
317
+
318
+ </div >
319
+
320
+ Example:
321
+
322
+ ``` python
323
+ PASTE CODE HERE
324
+ ```
325
+
326
+ ### Segmentation Stats
327
+
328
+ <div class =" clear " markdown >
329
+
330
+ ![ Image title] ( https://placehold.co/600x400/EEE/31343C ) { align=right loading=lazy width="50%"}
331
+
332
+ PASTE TEXT HERE
333
+
334
+ </div >
335
+
336
+ Example:
337
+
338
+ ``` python
339
+ PASTE CODE HERE
340
+ ```
341
+
342
+ ### Purchases Per Customer
343
+
344
+ <div class =" clear " markdown >
345
+
346
+ ![ Image title] ( https://placehold.co/600x400/EEE/31343C ) { align=right loading=lazy width="50%"}
347
+
348
+ PASTE TEXT HERE
349
+
350
+ </div >
351
+
352
+ Example:
353
+
354
+ ``` python
355
+ PASTE CODE HERE
356
+ ```
357
+
358
+ ### Days Between Purchases
359
+
360
+ <div class =" clear " markdown >
361
+
362
+ ![ Image title] ( https://placehold.co/600x400/EEE/31343C ) { align=right loading=lazy width="50%"}
363
+
364
+ PASTE TEXT HERE
365
+
366
+ </div >
367
+
368
+ Example:
369
+
370
+ ``` python
371
+ PASTE CODE HERE
372
+ ```
373
+
374
+ ### Transaction Churn
375
+
376
+ <div class =" clear " markdown >
377
+
378
+ ![ Image title] ( https://placehold.co/600x400/EEE/31343C ) { align=right loading=lazy width="50%"}
379
+
380
+ PASTE TEXT HERE
381
+
382
+ </div >
383
+
384
+ Example:
385
+
386
+ ``` python
387
+ PASTE CODE HERE
388
+ ```
0 commit comments