403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python312/Lib/site-packages/pandas/tests/groupby/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/site-packages/pandas/tests/groupby/__pycache__/test_counting.cpython-312.pyc
�

/	�g75���ddlmZddlmZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
mZmZddlmZGd�d�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zy)�)�product)�ascii_lowercaseN)�	DataFrame�Index�
MultiIndex�Period�Series�	Timedelta�	Timestamp�
date_rangec��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zej*j-dedd�D���cgc]}t1d|d�d����c}}}edd�D���cgc]}t1d|d�d����c}}}edd�D���cgc]}t1d|d�d�d����c}}}edd�D���cgc]}t3|d����c}}}edd�D���cgc]}t5dd|����c}}}g�d ��Zd!�Zd"�Zd#�Zy$cc}}}wcc}}}wcc}}}wcc}}}wcc}}}w)%�TestCountingc��tdgdgdgdgdggdg��}|jd�}|j}tgd��}t	j
||j
��t	j
||j
��y)N�a�b�A��columns�r��r��r�groupbyrr	�tm�assert_series_equal�cumcount��self�df�g�sg�expecteds     �DC:\Python312\Lib\site-packages\pandas/tests/groupby/test_counting.py�
test_cumcountzTestCounting.test_cumcountsq��
����u�s�e�c�U�S�E�:�S�E�
J���J�J�s�O��
�S�S���/�*��
���x�����6�
���x�����7�c� �t�jd��}tt��jd��}td��}t	j
||j
��t	j
||j
��y�Nr)�level��dtype�int64)rrr	�objectrrr�r�ge�se�es    r$�test_cumcount_emptyz TestCounting.test_cumcount_emptysg��
�[�
 �
 �q�
 �
)��
�&�
!�
)�
)��
)�
2��
��!��
���q�"�+�+�-�0�
���q�"�+�+�-�0r&c�.�tdgdgdgdgdggdgdgdz��}|jd�}|j}tgd�dgdz��}t	j
||j
��t	j
||j
��y)	Nrrrr��r�indexr�r6rrs     r$�test_cumcount_dupe_indexz%TestCounting.test_cumcount_dupe_index)s���
��U�S�E�C�5�3�%�#��/�#��q�c�A�g�
��
�J�J�s�O��
�S�S���/�!��q��9��
���x�����6�
���x�����7r&c�f�tjddgddgddgddgddgg�}tdgdgdgdgdggdg|��}|jd�}|j}tgd�|�	�}t
j||j��t
j||j��y)
Nrrrrrrr5rr7)	r�from_tuplesrrrr	rrr�r�mir r!r"r#s      r$�test_cumcount_mizTestCounting.test_cumcount_mi5s���
�
#�
#�a��V�a��V�a��V�a��V�a��V�$L�
M��
����u�s�e�c�U�S�E�:�S�E�QS�
T���J�J�s�O��
�S�S���/��4��
���x�����6�
���x�����7r&c�2�tdgdgdgdgdggdgdgdz��}|jgd��}|j}tgd�dgdz�	�}t	j
||j
��t	j
||j
��y)
Nrrrrr4r5�rrrrrrr7rrs     r$�test_cumcount_groupby_not_colz*TestCounting.test_cumcount_groupby_not_col@s���
��U�S�E�C�5�3�%�#��/�#��q�c�A�g�
��
�J�J��'��
�S�S���/�!��q��9��
���x�����6�
���x�����7r&c��tdtd�i�}|jd�}|j}t	gd��}tj||j��tj||j��y)Nr�aaabar?�r�listrrr	rr�ngrouprs     r$�test_ngroupzTestCounting.test_ngroupLsa��
��T�'�]�+�
,���J�J�s�O��
�S�S���/�*��
���x�����4�
���x�����5r&c�&�tdtd�i�}|jd�}|j}t	td�d��}t
j||j��t
j||j��y)Nr�abcder4r,r*)	rrDrrr	�rangerrrErs     r$�test_ngroup_distinctz!TestCounting.test_ngroup_distinctVsg��
��T�'�]�+�
,���J�J�s�O��
�S�S���%��(�'�2��
���x�����4�
���x�����5r&c��tddgdzi�}|jd�}|j}tdgdz�}t	j
||j
��t	j
||j
��y)Nrrr4)rrrr	rrrErs     r$�test_ngroup_one_groupz"TestCounting.test_ngroup_one_group`sg��
��a�S�1�W�~�
&���J�J�s�O��
�S�S���1�#��'�?��
���x�����4�
���x�����5r&c� �t�jd��}tt��jd��}td��}t	j
||j
��t	j
||j
��yr()rrr	r-rrrEr.s    r$�test_ngroup_emptyzTestCounting.test_ngroup_emptyjsg��
�[�
 �
 �q�
 �
)��
�&�
!�
)�
)��
)�
2��
��!��
���q�"�)�)�+�.�
���q�"�)�)�+�.r&c��tdtd�i�}ttd��}tj|j|�j
�|j|�j
��y)NrrB)rrDr	rrrrE)rr �ss   r$� test_ngroup_series_matches_framez-TestCounting.test_ngroup_series_matches_frametsU��
��T�'�]�+�
,���4��=�!��
���r�z�z�!�}�3�3�5�q�y�y��|�7J�7J�7L�Mr&c�,�tdtd�idgdz��}|jd�}|j}t	gd�dgdz��}tj||j��tj||j��y�NrrBrr4r7r?rCrs     r$�test_ngroup_dupe_indexz#TestCounting.test_ngroup_dupe_indexzsq��
��T�'�]�+�A�3��7�
;���J�J�s�O��
�S�S���/�!��q��9��
���x�����4�
���x�����5r&c�d�tjddgddgddgddgddgg�}tdtd�i|��}|j	d�}|j
}t
gd�|��}tj||j��tj||j��y)NrrrrrBr7r?)
rr:rrDrrr	rrrEr;s      r$�test_ngroup_mizTestCounting.test_ngroup_mi�s���
�
#�
#�a��V�a��V�a��V�a��V�a��V�$L�
M��
��T�'�]�+�2�
6���J�J�s�O��
�S�S���/��4��
���x�����4�
���x�����5r&c�0�tdtd�idgdz��}|jgd��}|j}t	gd�dgdz��}tj||j��tj||j��yrSrCrs     r$�test_ngroup_groupby_not_colz(TestCounting.test_ngroup_groupby_not_col�sr��
��T�'�]�+�A�3��7�
;���J�J��'��
�S�S���/�!��q��9��
���x�����4�
���x�����5r&c�`�tgd�dg��}|jdg�}tgd��}tgd��}tj||j
dz
|z
�tj||j
d���tj||j
d	���y)
N)rrrrrrr)rrrrr)rrrrrrT)�	ascendingF)rrr	rr�ngroupsrE)rr r!rZ�
descendings     r$�test_ngroup_descendingz#TestCounting.test_ngroup_descending�s���
�0�3�%�
@���J�J��u����?�+�	��O�,�
�
���z�A�I�I��M�Y�+F�G�
���y�!�(�(�T�(�*B�C�
���z�1�8�8�e�8�+D�Er&c�2�tddgddgddgddgddggddg��}|jddg�}|j�}|j�}t	gd��}t	gd	��}tj||�tj||�y)
Nr�x�yrr�Xrrr?)rrrErr	rr)rr r!�g_ngroup�
g_cumcount�expected_ngroup�expected_cumcounts       r$�test_ngroup_matches_cumcountz)TestCounting.test_ngroup_matches_cumcount�s���
��3�Z�#�s��c�3�Z�#�s��c�3�Z�H��#�J�
��
�J�J��S�z�"���8�8�:���Z�Z�\�
� ��1��"�?�3��
���x��9�
���z�+<�=r&c��ttd�d��D]�}td|i�}|jdg�}t	t|��}|D�cgc]}|j
|���}}t|�D��cgc]\}}|d|j|���}}}tj|j�t|��tj|j�t|����ycc}wcc}}w)Nr�)�repeatr)rrIrr�sorted�setr6�	enumerate�countrrrEr	r)	r�pr r!�order�val�ngroupd�i�
cumcounteds	         r$�test_ngroup_cumcount_pairz&TestCounting.test_ngroup_cumcount_pair�s�����q��!�,�		E�A��C��8�$�B��
�
�C�5�!�A��3�q�6�N�E�34�5�C�u�{�{�3�'�5�G�5�9B�1��F�v�q�#�!�B�Q�%�+�+�c�*�F�J�F��"�"�1�8�8�:�v�g��?��"�"�1�:�:�<��
�1C�D�		E��
6��Fs�C7�9C<c�j�tdtjjd�j	td�d�i�}|j
d|��}d|d<d|d<t|�D]Q\}\}}||j|jdf<t|j�D]\}}||j|df<��Stjt|dj�|j��tjt|dj�|j��y)	Nrr�abcdef�d)�sort����group_id�group_index)r�np�random�default_rng�choicerDrrl�locr6rrr	�valuesrEr)	rrxr r!rr�_�group�j�inds	         r$�"test_ngroup_respects_groupby_orderz/TestCounting.test_ngroup_respects_groupby_order�s��
��R�Y�Y�2�2�1�5�<�<�T�(�^�S�Q�R�
S���J�J�s��J�&����:����=��&�q�\�	/�M�A�z��5�./�B�F�F�5�;�;�
�*�+�#�E�K�K�0�
/���3�-.����s�M�)�*�
/�	/�
	���v�b��n�&;�&;�<�a�h�h�j�I�
���v�b��&7�&>�&>�?�����Nr&�datetimelikerrhz2016-05-�02dz 20:09:25+00:00z	 20:09:25�UTC)�tz�h)�unit�2Wi�)�freq�year�monthc���tgd�|d��}|jd�j�}tdddgiddg�	�}d|j_tj||�y)
N)rrr)r_r`r_r`rrrrr7)rrrmr6�namer�assert_frame_equal)rr�r �resr#s     r$�test_count_with_datetimelikez)TestCounting.test_count_with_datetimelike�s]���_�<�@�
A���j�j��o�#�#�%���c�A�q�6�]�3��*�=��!�����
���h��,r&c�R�ttjtjgddgddgd��}|jddg�jj�}t
gddgggggddg��}tg|tjd	�
�}tj||d��y)
Nrrrr�r�B�Crr�)�levels�codes�namesr�)r6r+r�F)�check_index_type)rr|�nanrr�rmrr	r,rr)rr �resultr<r#s     r$�(test_count_with_only_nans_in_first_groupz5TestCounting.test_count_with_only_nans_in_first_group�s���
�b�f�f�b�f�f�-�S�#�J�a��V�L�
M�����S�#�J�'�)�)�/�/�1��
��S�#�J�/��B�x��S�z�
R���"�B�b�h�h�S�A��
���v�x�%�Hr&c���tgd�ddtjddgd��}|jdg�j	�}ttgd�d�	�d
gd�i��}t
j||�y)
N)rrrrrr4rhrr)rr�r�)gg@g@g@�r�r)rrrr)r6�data)rr|r�rrmrrr�)rr r�r#s    r$�4test_count_groupby_column_with_nan_in_groupby_columnzATestCounting.test_count_groupby_column_with_nan_in_groupby_column�sg��
�_�A�q�"�&�&�!�Q�3G�H�
I���j�j�#���%�%�'����,�3�7�s�L�>Q�
��	���h��,r&c��tddd��}ttjd�|tjd�g��}|j	d��}|j�}ttjd�tjd�|g��}|j	d��}|j�}t
j||�y)Nz1/1/2012�5min�
)�startr��periodsr7c��|ddzdk(S)Nrrr��r_s r$�<lambda>z@TestCounting.test_groupby_count_dateparseerror.<locals>.<lambda>�����!��q��A�
�r&c��|ddzdk(S)Nrrr�r�s r$r�z@TestCounting.test_groupby_count_dateparseerror.<locals>.<lambda>�r�r&)rr	r|�arangerrmrr)r�dr�ser�groupedr�r#s      r$�!test_groupby_count_dateparseerrorz.TestCounting.test_groupby_count_dateparseerror�s���
�j�v�r�
B���R�Y�Y�r�]�2�r�y�y��}�*=�>���+�+�5�6��������R�Y�Y�r�]�2�9�9�R�=�"�*=�>���+�+�5�6���=�=�?��
���v�x�0r&N)�__name__�
__module__�__qualname__r%r2r8r=r@rFrJrLrNrQrTrVrXr]rfrtr��pytest�mark�parametrizerIrr
rr�r�r�r�)�.0rrrr_r
rs000000r$rrs_��8�1�
8�	8�
8�6�6�6�/�N�6�6�6�	F�
>�E�O��[�[����CH��A�;�O�O�a�Y��!�C���8�
9�O�=B�1�a�[�I�I��Y��!�C��	�2�
3�I�GL�Q�PQ�{�S�S�!�Y��!�C��	�2�u�
=�S�-2�1�a�[�9�9��Y�q�s�
#�9�<A�!�Q�K�H�H�q�V��D��
2�H�	
�	�-�	�-�I�-�1��E
P��I��S��9��Hs�D)�D0�+D7�D>�:Erc�.�ttd�tjd�j	d�d��}tddgt
ddgd�	�d
��}|jd�jj�}tj||�y)N�ababrhztimedelta64[ns])r!�deltarrrr!r�r��r6r�)rrDr|r��astyper	rrr�rmrr)r r#r�s   r$�#test_groupby_timedelta_cython_countr�sw��	��8�n�r�y�y��|�':�':�;L�'M�N�
�B��q�!�f�E�3��*�3�$?�g�N�H�
�Z�Z��_�
"�
"�
(�
(�
*�F����8�V�,r&c���d}td|dzd��}ttjj	d�jt
t�|�tjj	d�jdd|�tjj	d�j|�jd	�tjj	d�jd
d|�tjj	d�j||�tjj	d�j|�jd	�tjj	d�j|�jd	�tjj	d�j||�tjj	d�j|d�z
tjj	d�jt
t�|�d�	�}|jjgd
��D]Q}tj|jtjj	d�j||dz�|f<�S|djd�|d<ddddgfD]�}|j!|�j#�}d}t%j&t(|��5|j!|�j+tj"�j|d��}ddd�t%j,|���y#1swY�"xYw)Ni�z
2015-08-30r��min)r�r�rrr4ri����r)	�1st�2nd�3rd�4th�5th�6th�7th�8th�9th)r�r�r�r��categoryr�r�z7DataFrameGroupBy.apply operated on the grouping columns)�match)�axis)rrr|r}r~rrDr�integers�standard_normal�roundr�dropr�r�r�rrmr�assert_produces_warning�DeprecationWarning�applyr�)�nr�r �col�key�left�msg�rights        r$�
test_countr�
s����A�	�L�!�r�'��	>�B�	��9�9�(�(��+�2�2�4��3H�!�L��9�9�(�(��+�4�4�Q��1�=��9�9�(�(��+�;�;�A�>�D�D�Q�G��9�9�(�(��+�4�4�S�"�a�@��9�9�(�(��+�2�2�2�q�9��9�9�(�(��+�;�;�A�>�D�D�Q�G��9�9�(�(��+�;�;�A�>�D�D�Q�G��9�9�(�(��+�2�2�2�q�9��i�i�#�#�A�&�-�-�b�!�4�5��9�9�(�(��+�2�2�4��3H�!�L�	
�
�B��z�z���4�5�J��CE�6�6����r�y�y�$�$�Q�'�.�.�q�!�r�'�:�C�?�@�J��5�	� � ��,�B�u�I��u�u�e�n�-�+���z�z�#��$�$�&��G��
�
'�
'�(:�#�
F�	M��J�J�s�O�)�)�)�/�/�:�?�?��!�?�L�E�	M�
���d�E�*�+�	M�	M�s
�AM#�#M,	c�H�tgd�dtjdgdtjtjgggd���}|jd�j	�}|jdd�	�j	�}tdd
gddggdd
gddg��}d|j
_tj||j��tj||�|jd�dj	�}tj||d�y)N)rr�foor�barrr�rrF)�as_indexrrr�r�r5)rr|r�rrmr6r�rr��reset_indexr)r �count_as�count_not_asr#�count_Bs     r$�test_count_non_nullsr�*s���
�	��B�F�F�E�*�Q�������,?�@��
�B�
�z�z�#��$�$�&�H��:�:�c�E�:�2�8�8�:�L��1�a�&�1�a�&�)�C��:�a��V�L�H��H�N�N�����,��(<�(<�(>�?����(�H�-��j�j��o�c�"�(�(�*�G����7�H�S�M�2r&c�:�tdgdzdgdzzdgdzdgdzzd��}|jd�jj�}t	ddgtddgd��d��}t
j||�tdtjtjgdgdzzdgdzdgdzzd��}|jd�jj�}t	d	dgtddgd��d��}t
j||�y)
Nrrrr)r�cr�r�r�r)
rrrrmr	rrrr|r��r r�r#s   r$�test_count_objectr�>s��	�#����c�U�Q�Y�.�a�S�1�W��s�Q�w�5F�G�	H�B�
�Z�Z��_�
�
�
$�
$�
&�F��q�!�f�E�1�a�&�s�$;�#�F�H����6�8�,�	�#�r�v�v�r�v�v�.�#����:�!��q��A�3�QR�7�AR�S�	T�B�
�Z�Z��_�
�
�
$�
$�
&�F��q�!�f�E�1�a�&�s�$;�#�F�H����6�8�,r&c�l�tjtjjd�j	ddd�tjjd�j	ddd�f�jd�}t
|gd���}tj||dk(<|jdd	g�j�}d
D]g}|dj|�|d<|dj|�|d<|jdd	g�j�}tj||��iy)
Nrrr4)rwr�float64)rrr��drr�r�)�float32r-rr)r|�hstackr}r~r�r�rr�rrmrr�)�valsr r#�tr�s     r$�test_count_cross_typer�Js	���9�9��I�I�!�!�!�$�-�-�a��H�=��I�I�!�!�!�$�-�-�a��H�=�	
��

�f�Y��	�
�4�!5�	6�B��&�&�B�r�Q�w�K��z�z�3��*�%�+�+�-�H�
"�0���S�'�.�.��#��3���S�'�.�.��#��3�����S�#�J�'�-�-�/��
���f�h�/�	0r&c���ttjgd�tj�tjgd�tj�tjgd�tj
�t
d�d��}|jd�j�}tddgddgddgd�tt
d	�d�
���}tj||�y)N)rrrrw)rrr�)rhr4r��r�)rrr��grpr�r)rrr��abr�r7)rr|�array�int8�uint32�int16rDrrmrrr�r�s   r$�test_lower_int_prec_countr�_s���	����.�"�'�'�2����,��	�	�2����,����1���>�		
�
�B��Z�Z��
�
$�
$�
&�F���!�f�A�q�6��A��/�u�T�$�Z�e�7T��H����&�(�+r&c�`��Gd�dt��G�fd�d�}ttd�D�cgc]	}|���c}td�d��}|j	d�j�}td	d
d
git
td�d���
�}tj||�ycc}w)Nc��eZdZy)�Atest_count_uses_size_on_exception.<locals>.RaisingObjectExceptionN)r�r�r�r�r&r$�RaisingObjectExceptionr�ps��r&rc�.���eZdZdd�fd�
Z�fd�Z�xZS)�8test_count_uses_size_on_exception.<locals>.RaisingObjectc�0��t�|��||_y�N)�super�__init__r�)rr��	__class__s  �r$rzAtest_count_uses_size_on_exception.<locals>.RaisingObject.__init__ts����G����D�Hr&c�(���|j��r)r�)r�otherrs  �r$�__eq__z?test_count_uses_size_on_exception.<locals>.RaisingObject.__eq__xs���(����2�2r&)zI will raise inside Cython)�returnN)r�r�r�rr
�
__classcell__)rrs@�r$�
RaisingObjectrss���	�	3�	3r&r
rhr�)rr�r�rrr�r�r7)	�	ExceptionrrIrDrrmrrr�)r
r�r r�r#rs     @r$�!test_count_uses_size_on_exceptionros����
��
�3�3�
�5��8�<�a�-�/�<�T�(�^�T�	U�B�
�Z�Z��
�
$�
$�
&�F��#��1�v��e�D��J�U�.K�L�H����&�(�+��=s�B+c�
�tjd�tgd�tgd�|��d��}|j	d�j�}tddit
gd�d�	��
�}tj||�y)N�pyarrow)rrr)rrrr*)rrrrrr�r7)	r��importorskiprr	rrmrrr�)�any_string_dtyper r�r#s    r$�test_count_arrow_string_arrayr�si��
���	�"�	��f�_�<L�M�N�
�B��Z�Z��_�
"�
"�
$�F��#�q���y�s�)C�D�H����&�(�+r&)�	itertoolsr�stringr�numpyr|r��pandasrrrrr	r
rr�pandas._testing�_testingrrr�r�r�r�r�r�rrr�r&r$�<module>rs[���"��
�	�	�	��j1�j1�Z-�+�@3�(	-�0�*
,� ,�&,r&

Youez - 2016 - github.com/yon3zu
LinuXploit