o
    d                     @   sH   d Z ddlZddlZddlmZmZ ddlmZmZ dd Z	dd Z
dS )	zY
Test the consistency of the groupby API, both internally and with other pandas objects.
    N)	DataFrameSeries)DataFrameGroupBySeriesGroupByc           	      C   s  |dv rd}| j tjj|d |dv r"d}| j tjj|d |dkr/tt|r-J d S tt|}tt|}t	t
|j}|dkrIdh}nt	t
|j}t	 t	 }}|d	v rah d
}nl|dv rjddh}nc|dv rrdh}n[|dv rh d}h d}nN|dv rh d}ddh}nA|dv rh d}n8|dv rh d}n/|dv rddh}dh}n#|dv rdh}n|dv rdh}dh}n|dv rdh}n|dv rd dh}||@ |ksJ ||@ |ksJ ||8 }||8 }||ksJ d S )!Nfirstlastz?first and last are entirely different between frame and groupbyreason)cumcountzDataFrame has no such methodngroupsizeselfanyall>   axiskwargs	bool_only)countnumeric_onlyr   )nuniquemaxmin>   r   r   skipna   engine	min_countengine_kwargsmeanstdsumvarr   r   medianprodsembackfillbfillffillpad   r   inplacedowncastcummaxcumminr   argscumprodcumsum
pct_changer   rankquantilemethod)node
add_markerpytestmarkxfailhasattrr   getattrr   setinspect	signature
parameters)	requestgroupby_funcmsgframe_method	gb_methodresultexpectedexclude_expectedexclude_result rS   n/var/www/html/visualizacion-main/env/lib/python3.10/site-packages/pandas/tests/groupby/test_api_consistency.pytest_frame_consistency   sb   







rU   c           	      C   s  |dv rd}| j tjj|d |dv r"d}| j tjj|d |dkr/tt|r-J d S tt|}tt|}t	t
|j}|dkrIdh}nt	t
|j}t	 t	 }}|d	v rah d
}nk|dv ridh}nc|dv rvh d}h d}nV|dv rh d}ddh}nI|dv rh d}n@|dv rh d}n7|dv rddh}dh}n+|dv rdh}n#|dv rdh}dh}n|dv rdh}n|dv rddh}n|dv rdh}||@ |ksJ ||@ |ksJ ||8 }||8 }||ksJ d S ) Nr   z@first and last are entirely different between Series and groupbyr	   )r   corrwithzSeries has no such methodr   r   r   r   >   r   r   r   )diffr   r   >   r   r   r   r   r    r   r   r%   r)   r.   r1   r   r4   r   r5   r8   r   r:   )idxminidxmaxr<   )r?   r@   rA   rB   rC   rD   r   rE   r   rF   rG   rH   rI   )	rJ   rK   rL   series_methodrN   rO   rP   rQ   rR   rS   rS   rT   test_series_consistencyR   sb   







r[   )__doc__rG   rA   pandasr   r   pandas.core.groupby.genericr   r   rU   r[   rS   rS   rS   rT   <module>   s    ?