AlkantarClanX12

Your IP : 18.223.125.236


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/statistics.cpython-35.opt-2.pyc



���]ML�@svdddddddddd	d
gZddlZddlZdd
lmZddlmZddlmZGdd�de	�Z
ddd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd	�Zd d�Zd!d�Zd"d�Zd#d$d�Zd%d
�Zdd&d'�Zdd(d�Zdd)d�Zdd*d�Zdd+d�ZdS),�StatisticsError�pstdev�	pvariance�stdev�variance�median�
median_low�median_high�median_grouped�mean�mode�N)�Fraction)�Decimal)�groupbyc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�//opt/alt/python35/lib64/python3.5/statistics.pyrqscCs�d}t|�\}}||i}|j}ttt|��}xmt|t�D]\\}}	t||�}x>tt|	�D]-\}}|d7}||d�|||<q}WqRWd|kr�|d}
n%tdd�t|j	��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�_sumws#	

%r*cCs4y|j�SWntk
r/tj|�SYnXdS)N)Z	is_finite�AttributeError�math�isfinite)�xrrr�	_isfinite�s
r/cCs�||kr|S|tks(|tkr,|S|tkr<|St||�rO|St||�rb|St|t�ru|St|t�r�|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�y�t|�tkr|j�Sy|j|jfSWnXtk
r�y|j�SWn5tk
r�yt|�SWntk
r�YnXYnXYnXWn"ttfk
r�|dfSYnXd}t	|j
t|�j���dS)Nz0can't convert type '{}' to numerator/denominator)rr2�as_integer_ratio�	numerator�denominatorr+�_decimal_to_ratio�
OverflowError�
ValueErrorr3�formatr)r.r5rrrr�s"



rcCs�|j�\}}}|dkr+|dfSd}x|D]}|d|}q8W|dkrjd|}n|d|9}d}|r�|}||fS)N�Fr�Nr�
r)r=rr>)Zas_tuple)r�sign�digits�exp�numZdigitZdenrrrr9�s

r9cCs�t|�|kr|St|t�r:|jdkr:t}y||�SWn>tk
r�t|t�r�||j�||j�S�YnXdS)Nr)rr1rr8r2r3rr7)�valuer&rrr�_converts
rEcCs|tjt|��j�}|s%|S|dd}xBtdt|��D]+}||d|krI|d|�}PqIW|S)Nrr)�collections�Counter�iter�most_common�range�len)r#�tableZmaxfreq�irrr�_counts&srNcCsht|�|krt|�}t|�}|dkrBtd��t|�\}}}t|||�S)Nrz%mean requires at least one data point)rH�listrKrr*rE)r#rr&r)r%rrrr
6scCsrt|�}t|�}|dkr0td��|ddkrL||dS|d}||d||dSdS)Nrzno median for empty data�r)r!rKr)r#rrMrrrrQs

cCs`t|�}t|�}|dkr0td��|ddkrL||dS||ddSdS)Nrzno median for empty datarPr)r!rKr)r#rrrrriscCs<t|�}t|�}|dkr0td��||dS)Nrzno median for empty datarP)r!rKr)r#rrrrrs
rcCst|�}t|�}|dkr3td��n|dkrG|dS||d}x9||fD]+}t|ttf�rbtd|��qbWy||d}Wn,tk
r�t|�t|�d}YnX|j|�}|j	|�}|||d||S)Nrzno median for empty datarrPzexpected number but got %r)
r!rKr�
isinstance�str�bytesr3r2�indexr%)r#�intervalrr.�obj�LZcf�frrrr	�s"
cCsYt|�}t|�dkr*|ddS|rItdt|���ntd��dS)Nrrz.no unique mode; found %d equally common valueszno mode for empty data)rNrKr)r#rLrrrr�scs��dkrt|��t�fdd�|D��\}}}t�fdd�|D��\}}}||dt|�8}||fS)Nc3s|]}|�dVqdS)rPNr)rr.)�crrr�sz_ss.<locals>.<genexpr>c3s|]}|�VqdS)Nr)rr.)rYrrr�srP)r
r*rK)r#rYr&r)r%�UZtotal2Zcount2r)rYr�_ss�s((r[cCslt|�|krt|�}t|�}|dkrBtd��t||�\}}t||d|�S)NrPz*variance requires at least two data pointsr)rHrOrKrr[rE)r#�xbarrr&�ssrrrrs&cCsht|�|krt|�}t|�}|dkrBtd��t||�\}}t|||�S)Nrz*pvariance requires at least one data point)rHrOrKrr[rE)r#�murr&r]rrrr0s'cCsCt||�}y|j�SWntk
r>tj|�SYnXdS)N)r�sqrtr+r,)r#r\�varrrrr`s
	
cCsCt||�}y|j�SWntk
r>tj|�SYnXdS)N)rr_r+r,)r#r^r`rrrrps
	
)�__all__rFr,Z	fractionsr
Zdecimalr�	itertoolsrr;rr*r/rrr9rErNr
rrrr	rr[rrrrrrrr�<module>_s69%1*/0