Total Complexity | 3 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import scipy.stats as stats |
||
2 | from tabpy.models.utils import setup_utils |
||
3 | |||
4 | |||
5 | def anova(_arg1, _arg2, *_argN): |
||
6 | ''' |
||
7 | ANOVA is a statistical hypothesis test that is used to compare |
||
8 | two or more group means for equality.For more information on |
||
9 | the function and how to use it please refer to tabpy-tools.md |
||
10 | ''' |
||
11 | |||
12 | cols = [_arg1, _arg2] + list(_argN) |
||
13 | for col in cols: |
||
14 | if not isinstance(col[0], (int, float)): |
||
15 | print("values must be numeric") |
||
16 | raise ValueError |
||
17 | _, p_value = stats.f_oneway(_arg1, _arg2, *_argN) |
||
18 | return p_value |
||
19 | |||
20 | |||
21 | if __name__ == '__main__': |
||
22 | setup_utils.deploy_model( |
||
23 | 'anova', |
||
24 | anova, |
||
25 | 'Returns the p-value form an ANOVA test') |
||
26 |