hNa10ddlZddlZddlZGddZy)NceZdZdZdZdZdZdZdZdZ	dZ
d	Zd
Ze
dZdZd
ZdZdZdZdZdZdZdZdZdZ	dZdZ	dZe
dZe
dZy)	Analyticsc||_|j|_|j|_|j|_|j|_|j|_
|j|_|j|_|j|_|j#|_yN)_Analytics__arraycount_Analytics__countsum_Analytics__sumavg_Analytics__avgmedian_Analytics__medianmode2_Analytics__modemin_Analytics__minmax_Analytics__maxrange_Analytics__rangestdDev_Analytics__stdDev)selfarrays  :/home/s/sultans/web/python/demo/oo/zAnalytics/Analytics.py__init__zAnalytics.__init__s~

















c|jSr)r	rs rgetCountzAnalytics.getCount",rc|jSr)rr s rgetSumzAnalytics.getSum#

*rc|jSr)r
r s rgetAvgzAnalytics.getAvg$r%rc|jSr)rr s r	getMedianzAnalytics.getMedian%

-rc|jSr)rr s rgetModezAnalytics.getMode&s+rc|jSr)rr s rgetMinzAnalytics.getMin'r%rc|jSr)rr s rgetMaxzAnalytics.getMax(r%rc|jSr)rr s rgetRangezAnalytics.getRange)r"rc|jSr)rr s r	getStdDevzAnalytics.getStdDev*r*rc`g}|D]}	t|}|j|!|S#Y(xYwr)floatappend)rarray2colnums    r	normalizezAnalytics.normalize/s<C
Cj

c"

s)-c,t|jSr)lenrr s rrzAnalytics.count?c$,,//rc,t|jSr)r
rr s rr
z
Analytics.sum@r>rc,t|jSr)rrr s rrz
Analytics.minAr>rc,t|jSr)rrr s rrz
Analytics.maxBr>rcXt|jt|jz
Sr)rrrr s rrzAnalytics.rangeCsc$,,/#dll2CCCrc@tj|jSr)
statisticsmeanrr s rrz
Analytics.avgEsjoodll;;rc@tj|jSr)rDrrr s rrzAnalytics.medianFj//==rc@tj|jSr)rD
median_lowrr s rmedianLzAnalytics.medianLGsj33DLLAArc@tj|jSr)rDmedian_highrr s rmedianHzAnalytics.medianHHsj44T\\BBrc@tj|jSr)rDpstdevrr s rrzAnalytics.stdDevJrGrc@tj|jSr)rDstdevrr s rstdDevSzAnalytics.stdDevSKsj..t||<<rctjj}d}d}g}t|j}|D]0}||k(r|dz
}||kDr|}g}||k\r|j|d}|}2||kDr|}g}||k\r|j||S)Nr)sys
float_inforsortedrr7)rprevCol	prevCountmaxOccurmodesr8r9s       rmodezAnalytics.modegsNN&&	%Cg~Q	x'(HE(LL)	x HE LL!rcd}g}i}|jD]}	||xxdz
cc<t|jdd}|D]"}|\}}||kr|S|j||}$|S#d||<YbxYw)NrTrUc|dS)NrU)elems r<lambda>z!Analytics.mode2.<locals>.<lambda>sT!WrT)keyreverse)rrXitemsr7)rr[r\dictralistOfTuplestupleoccurs        rrzAnalytics.mode2sLLD
 T
a
!djjl0DdS!E!MT5x
LLH"
 T
s
A,,A5cdt|jz}|dt|jzz
}|dt|jzz
}|dt|jzz
}|dt|j
zz
}|dt|jzz
}|dt|jzz
}|dt|jzz
}|d	t|jzz
}|d
t|jzz
}|S)Nz
Data points: z
Count......: z
Sum........: z
Average....: z
Median.....: z
Mode.......: z
Minimum....: z
Maximum....: z
Range......: z
Std.Dev....: )strrr	rr
rrrrrr)rdatas  r__str__zAnalytics.__str__sC$66!C$666!C

$666!C

$666!C

$666!C$666!C

$666!C

$666!C$666!C

$666rcd}g}|dk(r||}|dk(rt|}t|}||}|dk(r|D]}|D]}|j||S)Nrrowr9all)ziplistr7)		array2dimtypeidxsizerobjr8ror9s	         rslicezAnalytics.slicesl5LcNE5L)_C#YFC[E5L CLL%!rc4t|}tt}|Sr)rqrrrw)rsr8s  r	transposezAnalytics.transposesic
rN)__name__
__module____qualname__rr!r$r'r)r,r.r0r2r4staticmethodr;rr
rrrrrrJrMrrRr]rrmrxrzr`rrrr
s&"-**-+**,-


0///C;=AB=<,>B".rr)mathrDrVrr`rr<module>rs
VVr