GenAICoder commited on
Commit
a32ecf8
·
verified ·
1 Parent(s): 27fb8bb

Create performance_analysis.py

Browse files
Files changed (1) hide show
  1. analytics/performance_analysis.py +34 -0
analytics/performance_analysis.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # analytics/performance_analysis.py
2
+
3
+ from metrics.metric_registry import (
4
+ METRIC_FUNCTIONS
5
+ )
6
+
7
+
8
+ def generate_metric_view(
9
+ df,
10
+ metric_name,
11
+ group_col=None,
12
+ filters=None
13
+ ):
14
+
15
+ metric_config = METRIC_FUNCTIONS[
16
+ metric_name
17
+ ]
18
+
19
+ metric_function = metric_config[
20
+ "function"
21
+ ]
22
+
23
+ metric_params = metric_config[
24
+ "params"
25
+ ]
26
+
27
+ result = metric_function(
28
+ df=df,
29
+ group_col=group_col,
30
+ filters=filters,
31
+ **metric_params
32
+ )
33
+
34
+ return result