Passed
Push — master ( 305552...00a4d3 )
by Oleksandr
02:44
created

tabpy.models.scripts.ANOVA   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 16
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A anova() 0 14 3
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