-
Notifications
You must be signed in to change notification settings - Fork 1
/
eda.py
44 lines (29 loc) · 884 Bytes
/
eda.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import numpy as np
import pandas as pd
class analyze():
def __init__(self):
pass
def show_grp(self,df,col):
self.grp=df.groupby(col)
return self.grp.first()
def perform_agregate(self,funcs):
agg1=[]
if "Mean" in funcs:
agg1.append(np.mean)
if "Median" in funcs:
agg1.append(np.median)
if "Standard Deviation" in funcs:
agg1.append(np.std)
if "Count" in funcs:
agg1.append(np.count)
if "Max" in funcs:
agg1.append(np.max)
if "Min" in funcs:
agg1.append(np.min)
if "Variance" in funcs:
agg1.append(np.var)
try:
group_agg=self.grp.agg(agg1).reset_index()
except:
group_agg=""
return group_agg