Your IP : 3.137.177.116


Current Path : /proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/statistics.cpython-37.opt-2.pyc

B

YI~d�P�@s4dddddddddd	d
dgZdd
lZdd
lZdd
lZddlmZddlmZddlm	Z	ddl
mZmZGdd�de
�Zd4dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd5d$d%�Zd&d	�Zd'd�Zd(d�Zd)d�Zd*d�Zd6d,d�Zd-d
�Zd7d.d/�Zd8d0d�Z d9d1d�Z!d:d2d�Z"d;d3d�Z#d
S)<�StatisticsError�pstdev�	pvariance�stdev�variance�median�
median_low�median_high�median_grouped�mean�mode�
harmonic_mean�N)�Fraction)�Decimal)�groupby)�bisect_left�bisect_rightc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�//opt/alt/python37/lib64/python3.7/statistics.pyrbscCs�d}t|�\}}||i}|j}ttt|��}xRt|t�D]D\}}	t||�}x0tt|	�D]"\}}|d7}||d�|||<qVWq8Wd|kr�|d}
ntdd�t|�	��D��}
||
|fS)Nr
�css|]\}}t||�VqdS)N)r)�.0�d�nrrr�	<genexpr>�sz_sum.<locals>.<genexpr>)
�_exact_ratio�get�_coerce�int�typer�map�sum�sorted�items)�data�start�countrrZpartialsZpartials_get�T�typ�values�totalrrr�_sumhs$
r-cCs(y|��Stk
r"t�|�SXdS)N)Z	is_finite�AttributeError�mathZisfinite)�xrrr�	_isfinite�sr1cCs�||kr|S|tks|tkr |S|tkr,|St||�r:|St||�rH|St|t�rV|St|t�rd|St|t�r|t|t�r||St|t�r�t|t�r�|Sd}t||j|jf��dS)Nz"don't know how to coerce %s and %s)r �bool�
issubclassr�float�	TypeErrorr)r)�S�msgrrrr�s(



rcCs�ydt|�tkst|�tkr"|��Sy|j|jfStk
r`y|��Stk
rZYnXYnXWnttfk
r�|dfSXd}t	|�
t|�j���dS)Nz0can't convert type '{}' to numerator/denominator)r!r4r�as_integer_ratio�	numerator�denominatorr.�
OverflowError�
ValueErrorr5�formatr)r0r7rrrr�s
rcCsjt|�|kr|St|t�r(|jdkr(t}y||�Stk
rdt|t�r^||j�||j�S�YnXdS)Nr)r!r3r r:r4r5rr9)�valuer)rrr�_convert�s
r?cCs`t�t|����}|s|S|dd}x4tdt|��D]"}||d|kr6|d|�}Pq6W|S)Nr
r)�collections�Counter�iter�most_common�range�len)r&�tableZmaxfreq�irrr�_counts�srHcCs.t||�}|t|�kr&|||kr&|St�dS)N)rrEr<)�ar0rGrrr�
_find_lteqs
rJcCs>t|||d�}|t|�dkr6||d|kr6|dSt�dS)N)�lor)rrEr<)rI�lr0rGrrr�
_find_rteqs rM�negative valueccs(x"|D]}|dkrt|��|VqWdS)Nr
)r)r+�errmsgr0rrr�	_fail_negs
rPcCsHt|�|krt|�}t|�}|dkr,td��t|�\}}}t|||�S)Nrz%mean requires at least one data point)rB�listrErr-r?)r&rr)r,r(rrrr
"scCs�t|�|krt|�}d}t|�}|dkr2td��n<|dkrn|d}t|tjtf�rf|dkrbt|��|Std��y"t	dd�t
||�D��\}}}Wntk
r�dSXt|||�S)Nz.harmonic mean does not support negative valuesrz.harmonic_mean requires at least one data pointr
zunsupported typecss|]}d|VqdS)rNr)rr0rrrrcsz harmonic_mean.<locals>.<genexpr>)
rBrQrEr�
isinstance�numbersZRealrr5r-rP�ZeroDivisionErrorr?)r&rOrr0r)r,r(rrrr<s$
"cCs\t|�}t|�}|dkr td��|ddkr8||dS|d}||d||dSdS)Nr
zno median for empty data�r)r$rEr)r&rrGrrrrks
cCsLt|�}t|�}|dkr td��|ddkr8||dS||ddSdS)Nr
zno median for empty datarUr)r$rEr)r&rrrrr�scCs,t|�}t|�}|dkr td��||dS)Nr
zno median for empty datarU)r$rEr)r&rrrrr�s
rc
Cs�t|�}t|�}|dkr"td��n|dkr2|dS||d}x*||fD]}t|ttf�rHtd|��qHWy||d}Wn(tk
r�t|�t|�d}YnXt||�}t	|||�}|}||d}	|||d||	S)Nr
zno median for empty datarrUzexpected number but got %r)
r$rErrR�str�bytesr5r4rJrM)
r&�intervalrr0�obj�L�l1�l2Zcf�frrrr	�s&

cCsBt|�}t|�dkr |ddS|r6tdt|���ntd��dS)Nrr
z.no unique mode; found %d equally common valueszno mode for empty data)rHrEr)r&rFrrrr�scsd�dkrt|��t�fdd�|D��\}}}t�fdd�|D��\}}}||dt|�8}||fS)Nc3s|]}|�dVqdS)rUNr)rr0)�crrrsz_ss.<locals>.<genexpr>c3s|]}|�VqdS)Nr)rr0)r^rrrsrU)r
r-rE)r&r^r)r,r(�UZtotal2Zcount2r)r^r�_ss
sr`cCsLt|�|krt|�}t|�}|dkr,td��t||�\}}t||d|�S)NrUz*variance requires at least two data pointsr)rBrQrErr`r?)r&�xbarrr)�ssrrrr!s&cCsHt|�|krt|�}t|�}|dkr,td��t||�\}}t|||�S)Nrz*pvariance requires at least one data point)rBrQrErr`r?)r&�murr)rbrrrrPs'cCs2t||�}y|��Stk
r,t�|�SXdS)N)r�sqrtr.r/)r&ra�varrrrr�s
	
cCs2t||�}y|��Stk
r,t�|�SXdS)N)rrdr.r/)r&rcrerrrr�s
	
)r
)rN)r)N)N)N)N)N)$�__all__r@r/rSZ	fractionsrZdecimalr�	itertoolsrZbisectrrr<rr-r1rrr?rHrJrMrPr
rrrrr	rr`rrrrrrrr�<module>Os@

: 

/
7*

/
0


?>