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/arrays/categorical/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/site-packages/pandas/tests/arrays/categorical/__pycache__/test_api.cpython-312.pyc
�

.	�g�M���ddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZmZddl
mZddlmZGd�d�ZGd�d�ZGd	�d
�Zy)�N)�PY311)�Categorical�CategoricalIndex�	DataFrame�Index�Series�StringDtype)�recode_for_categoriesc��eZdZd�Zd�Zd�Zd�Zejjdgd�ddgg�d	��Z
d
�Zd�Zd�Z
ejjdd
ggd�gd�g�d��Zd�Zd�Zd�Zd�Zejjdgd�d
dgd
dgfgd�d
dgdd
gfgd�d
dgd
dgfgd�d
dgdd
gfgd�d
dgd
dgfgd�d
dgdd
gfgd�d
dgd
dgfgd�d
dgd
dgfgd�d
dgd
gfgd�d
dgdgfgd�d
dgd
gfgd�d
dgd
gfgd�d
dgddgfg
�ejjdddg�d ���Zd!�Zd"�Zd#�Zejjd$d%gd%ej0gd%d%d%gg�d&��Zd'�Zy())�TestCategoricalAPIc��ttd�d��}d}tjt|��5|j�ddd�y#1swYyxYw)N�acbF��orderedz5Categorical.to_list is deprecated and will be removed��match)r�list�tm�assert_produces_warning�
FutureWarning�to_list)�self�cat1�msgs   �JC:\Python312\Lib\site-packages\pandas/tests/arrays/categorical/test_api.py�test_to_list_deprecatedz*TestCategoricalAPI.test_to_list_deprecatedsE���4��;��6��E��
�
'�
'�
�S�
A�	��L�L�N�	�	�	�s�A�Ac��ttd�d��}tj|jtgd���|jrJ�ttd�td�d��}tj|jtgd���|jrJ�ttd�d��}tj|jtgd���|jsJ�ttd�td�d��}tj|jtgd���|jsJ�y)	NrFr��a�b�c�bca��
categoriesr)r r!rT)rrr�assert_index_equalr$rr)rr�cat2�cat3�cat4s     r�test_ordered_apiz#TestCategoricalAPI.test_ordered_apis����4��;��6��
���d�o�o�u�_�/E�F��<�<����4��;�4��;��N��
���d�o�o�u�_�/E�F��<�<����4��;��5��
���d�o�o�u�_�/E�F��|�|��|��4��;�4��;��M��
���d�o�o�u�_�/E�F��|�|��|�c��tgd�d��}|j�}|jrJ�|j�}|jsJ�|j	d�jsJ�|j	d�jrJ�t
rdnd}t
jt|��5d|_ddd�t
jt|��5d|_ddd�y#1swY�5xYw#1swYyxYw)N�rr r!rTrFz8property 'ordered' of 'Categorical' object has no setter�can't set attributer)	r�as_unorderedr�
as_ordered�set_orderedr�pytest�raises�AttributeError)r�catr&rs    r�test_set_orderedz#TestCategoricalAPI.test_set_ordered.s����.��=�����!���<�<����~�~����|�|��|�����%�-�-�-�-��#�#�E�*�2�2�2�2�
�
G�&�	�
�]�]�>��
5�	��C�K�	�
�]�]�>��
5�	 ��C�K�	 �	 �	�	��	 �	 �s�+C'�C3�'C0�3C<c��tgd��}|jgd��}tj|j	�tjgd�t
j���tj|jtgd���tjgd�t
j��}tj|j	�|�tgd��}tj|j|�|jd��}tgd��}tj||�y)Nr,����)r8r9r:r8��dtyperc�"�|j�S)N)�upper)�xs r�<lambda>z;TestCategoricalAPI.test_rename_categories.<locals>.<lambda>Ts������r*)�A�B�CrA)
r�rename_categoriesr�assert_numpy_array_equal�	__array__�np�array�int64r%r$r�object_�assert_categorical_equal)rr4�res�exp_cat�result�expecteds      r�test_rename_categoriesz)TestCategoricalAPI.test_rename_categoriesCs����.�/���#�#�I�.��
�#�#��M�M�O�R�X�X�l�"�(�(�C�	
�	���c�n�n�e�I�.>�?��(�(�/�r�z�z�B��
�#�#�C�M�M�O�W�=���(��
���c�n�n�g�6��&�&�':�;���3�4��
�#�#�F�H�5r*�new_categories�r8r9r:�r8r9c��tgd��}d}tjt|��5|j	|�ddd�y#1swYyxYw)Nr,zKnew categories need to have the same number of items as the old categories!r)rr1r2�
ValueErrorrD�rrQr4rs    r�*test_rename_categories_wrong_length_raisesz=TestCategoricalAPI.test_rename_categories_wrong_length_raisesXsJ���.�/��
�	��]�]�:�S�
1�	2��!�!�.�1�	2�	2�	2�s�A�Ac��tddg�}|jtddgddg���}tddg�}tj||�y)Nrr rr8��index)rrDrrrK)rr!rNrOs    r�test_rename_categories_seriesz0TestCategoricalAPI.test_rename_categories_seriesbsM����c�
�#���$�$�V�Q��F�3��*�%E�F����1�v�&��
�#�#�F�H�5r*c	��tgd��}|jddddd��}tgd��}tj|j
|�tgd��}|jddd��}tgd��}tj|j
|�tgd��}|jddddd	d
d��}tgd��}tj|j
|�tgd��}|jddd
��}tgd��}tj|j
|�y)N�rr r!�drSr:r9r8�rSr:r9r8)rr!)r8r r:r^��)rr r!r^�e�frR)rc�g)rrDrrr%r$)rr4rLrOs    r�test_rename_categories_dictz.TestCategoricalAPI.test_rename_categories_dictis���.�/���#�#�!�!�!�!�$D�E����&��
���c�n�n�h�7��.�/���#�#�!�!�$4�5���)�*��
���c�n�n�h�7��.�/���#�#�!�!�!�!�!�RS�$T�U����&��
���c�n�n�h�7��.�/���#�#�!�!�$4�5���-�.��
���c�n�n�h�7r*c���tgd�d��}|j�}tgd�gd�d��}|jgd��}tj||�tj||�y)Nr,Tr�r!r rr#)r�copy�reorder_categoriesrrK�rr4�old�newrLs     r�test_reorder_categoriesz*TestCategoricalAPI.test_reorder_categories�s]���.��=���h�h�j��� �_�d�
���$�$�_�5��
�#�#�C��-�
�#�#�C��-r*r�rr r^r]c��tgd�d��}d}tjt|��5|j	|�ddd�y#1swYyxYw)Nr,Trz=items in new_categories are not the same as in old categoriesr)rr1r2rUrirVs    r�test_reorder_categories_raisesz1TestCategoricalAPI.test_reorder_categories_raises�sG���.��=��M��
�]�]�:�S�
1�	3��"�"�>�2�	3�	3�	3�s�A�Ac�Z�tgd�d��}|j�}tgd�gd�d��}|jd�}tj||�tj||�|jdg�}tj||�tj||�ttd�d��}ttd�td�d��}|jt
dd	g��}tj||�|jtjdd	g��}tj||�|jtdd	g��}tj||�|jdd	g�}tj||�y)
Nr,Trr]r#r^�abc�abcderb)
rrh�add_categoriesrrKrrrGrHr)rr4rkrlrLrOs      r�test_add_categoriesz&TestCategoricalAPI.test_add_categories�s[���.��=���h�h�j��� �-A�4�
��� � ��%��
�#�#�C��-�
�#�#�C��-�� � �#��'��
�#�#�C��-�
�#�#�C��-��$�u�+�t�4���t�E�{�t�G�}�d�S��� � ���c�
�!3�4��
�#�#�C��2�� � ����3��*�!5�6��
�#�#�C��2�� � ���S�z�!2�3��
�#�#�C��2�� � �#�s��,��
�#�#�C��2r*c���tgd�d��}tjd�}tjt
|��5|j
dg�ddd�y#1swYyxYw)Nr]Trz5new categories must not include old categories: {'d'}rr^)r�re�escaper1r2rUrt)rr4rs   r�#test_add_categories_existing_raisesz6TestCategoricalAPI.test_add_categories_existing_raises�sQ���.��=���i�i�O�P��
�]�]�:�S�
1�	&�����u�%�	&�	&�	&�s�A�A%c��ttddgd���}tdgd��}|j|�}ttddgd��tgd�d����}tj||�ttgd�t����}td	gt���}|j|�}ttgd�t���tgd
�t�����}tj||�y)Nr8r9�Int64r;rS)r8r9rS�r$�rr rr^rn)rrrtrrKr	)rr4�serrNrOs     r�,test_add_categories_losing_dtype_informationz?TestCategoricalAPI.test_add_categories_losing_dtype_information�s����&�!�Q��w�7�8���a�S��(���#�#�C�(����A�q�6��)�f�Y�g�6V�
��	�#�#�F�H�5��&���
�F�G���c�U�+�-�0���#�#�C�(����?�+�-�8��o�[�]�C�
��	�#�#�F�H�5r*c�	�tgd�d��}tgd��}tjgd�tj��}|jgd��}|jgd��}t
j|j|�t
j|j�|�tgd��}t
j|j|�t
j|j�|�tgd�d��}|jdg�}t
j|jtjgd�tj���|jgd	��}t
j|jtjgd
�tj���t
j|jtgd	���|jgd��}tgd��}t
j|j|�tgd�gd
�d��}t
j|jtjgd�tj���t
j|jtgd
���tjgd�tj��}t
jtj|�|�|jgd��}t
j|jtjgd�tj���t
j|jtgd���tjgd�tj��}t
jtj|�|�|j!�dk(sJ�|j#�dk(sJ�|jgd�d��}|j$rJ�t
jtj|�tj|��|j'd�jgd��}|j$rJ�t
jtj|�tj|��y)Nr,Trrgr;rr)r���r�rrn)rr8r�rr])r8r9r:rSr8rRr#)rr8r9r:rr_)r:r9r8rr:rSr8F)rrrGrHrJ�set_categoriesrr%r$rErF�codes�int8�_codesrI�asarray�min�maxrr0)	rr4�exp_categories�
exp_valuesrL�exp_categories_backr!�exp�c2s	         r�test_set_categoriesz&TestCategoricalAPI.test_set_categories�s���.��=����/���X�X�2�"�*�*�E�
�� � ��1��� � ��1��
���c�n�n�n�=�
�#�#�C�M�M�O�Z�@�#�O�4��
���c�n�n�.A�B�
�#�#�C�M�M�O�Z�@��.��=��� � �#��'��
�#�#�C�I�I�r�x�x��b�g�g�/V�W�� � ��1��
�#�#�C�I�I�r�x�x�
�R�W�W�/U�V�
���c�n�n�e�O�.D�E�� � �!5�6���3�4��
���c�n�n�n�=�
��L�$�O��
�#�#�A�H�H�b�h�h��b�g�g�.V�W�
���a�l�l�E�,�,?�@��h�h��b�h�h�7��
�#�#�B�J�J�q�M�3�7�
���\�*��	�#�#�A�H�H�b�h�h��b�g�g�.V�W�	���a�l�l�E�,�,?�@��h�h��b�h�h�7��
�#�#�B�J�J�q�M�3�7��u�u�w�!�|��|��u�u�w�!�|��|��
�
�l�E�
�
:���:�:��~�
�#�#�B�J�J�q�M�2�:�:�b�>�B��]�]�5�
!�
0�
0��
>���:�:��~�
�#�#�B�J�J�q�M�2�:�:�b�>�Br*z"values, categories, new_categoriesr}r )r rrr)r rr!r^rbrTFc��t||�}t|||�}|j||��}tj||�y)Nr)rr�rrK)r�valuesr$rQrr!rOrNs        r�test_set_categories_manyz+TestCategoricalAPI.test_set_categories_manysC��6
��
�+���v�~�w�?���!�!�.�'�!�B��
�#�#�F�H�5r*c��tddg�}|jdgd��}tdtjg�}t	j
||�y)NrArBT)�rename)rr�rG�nanrrK)rr4rNrOs    r�test_set_categories_rename_lessz2TestCategoricalAPI.test_set_categories_rename_less7sI���3��*�%���#�#�S�E�$�#�7����R�V�V�}�-��
�#�#�F�H�5r*c�P�tgd�gd���}|jgd��tgd�td���}tj||�tgd�gd���}|jgd�d��tgd�td���}tj||�y)	Nrr]r|)rr!r^rb)rr!r^�acdeT)�fastpath)r�_set_categoriesrrrK)rr4rOs   r�test_set_categories_privatez.TestCategoricalAPI.test_set_categories_private>s����/�6J�K�����0�1���4��<�H��
�#�#�C��2��/�6J�K�����0�4��@���4��<�H��
�#�#�C��2r*c�|�tgd�d��}|j�}tddtjdgddgd��}|j	d�}tj||�tj||�|j	dg�}tj||�tj||�y)Nr,Trrr r#r!)rrhrGr��remove_categoriesrrKrjs     r�test_remove_categoriesz)TestCategoricalAPI.test_remove_categoriesJs����.��=���h�h�j���3��R�V�V�S�1�s�C�j�RV�W���#�#�C�(��
�#�#�C��-�
�#�#�C��-��#�#�S�E�*��
�#�#�C��-�
�#�#�C��-r*�removalsr!c���tgd��}tjd�}tjt
|��5|j
|�ddd�y#1swYyxYw)Nr}z-removals must all be in old categories: {'c'}r)rrwrxr1r2rUr�)rr�r4�messages    r�test_remove_categories_raisesz0TestCategoricalAPI.test_remove_categories_raisesWsL���/�*���)�)�K�L��
�]�]�:�W�
5�	,��!�!�(�+�	,�	,�	,�s�A�A"c	�:�tgd�gd���}tgd��}tgd��}tj|j|�|j�}tj|j|�tj|j|�tdddtjggd���}|j�}tj|jtt
jgd����t
jgd	�tj�
�}tj|j|�tj|j|�dtjdd
ddtjg}t|td���}|j�}tj|jtgd���t
jgd�tj�
�}tj|j|�|j�|k(sJ�td�}	tjjd�j!|	ddd�d�j#d�}tj|tjjd�j!t%|�d�<t||	��}|j�}|j�|j�k(sJ�y)N)rr r!r^r)rr r!r^rbr|r]rr r!r)rr8r9r�r;�F�DrB�ABCDEFG)r�r$)rBr�r�)r9r�r8rr8r9r��abcdefghijklmnopqrstuvwxyzr9i'�object�d)rrrr%r$�remove_unused_categoriesrGr�rHr�rEr�r�tolist�random�default_rng�choice�astype�len)
rr!�exp_categories_all�exp_categories_droppedrL�	exp_codes�valr4�out�alphas
          r�test_remove_unused_categoriesz0TestCategoricalAPI.test_remove_unused_categories_s/���1�>W�X��"�#<�=��!&�';�!<��
���a�l�l�,>�?��(�(�*��
���c�n�n�.D�E�
���a�l�l�,>�?�
��c�3����/�<U�V���(�(�*��
���c�n�n�e�B�H�H�_�4M�.N�O��H�H�]�"�'�'�:�	�
�#�#�C�I�I�y�9�
���a�l�l�,>�?��B�F�F�C��c�3����7�����i��A���*�*�,��
���c�n�n�e�O�.D�E��H�H�4�B�G�G�D�	�
�#�#�C�I�I�y�9��z�z�|�s�"�"�"��1�2���i�i�#�#�A�&�-�-�e�C�a�C�j�%�@�G�G��Q��>@�f�f��B�I�I�!�!�!�$�+�+�C��H�c�:�;����7���*�*�,���z�z�|�s�z�z�|�+�+�+r*N)�__name__�
__module__�__qualname__rr)r5rPr1�mark�parametrizerWr[rermrpruryrr�r�r�r�r�rGr�r�r��r*rrrs!����$ �*6�*�[�[���-��q�!�f�/E�F�2�G�2�6�8�6.��[�[����
�E�� �	
��3��3�3�8&�6�&@C�D�[�[���,��s�C�j�3��*�5�
�s�C�j�3��*�5�
�s�C�j�3��*�5�
�s�C�j�3��*�5�
�s�C�j�3��*�5�
�s�C�j�3��*�5�
�s�C�j�3��*�5�
�s�C�j�3��*�5�
�s�C�j�3�%�0�
�s�C�j�3�%�0�
�s�C�j�3�%�0�
�s�C�j�3�%�0�
�s�C�j�3��*�5�)	
��2�[�[���Y��u�
�6�6�7�3�46�6�
3�.��[�[���Z�3�%�#�r�v�v���c�3�Z�)P�Q�,�R�,�!,r*rc��eZdZd�Zy)�TestCategoricalAPIWithFactorc��tgd�d��}|j�}|jsJ�tgd�d|j��}t	gd�gd�d	�|�
�}tj||�|j�}|jgd��}|j�}ttd�|jd�
�}t	gd�gd�d	�|�
�}tj||�tgd��}|j�}tgd�|jd�
�}t	gd�gd�d	�|�
�}tj||�ttjdddg�}|j�}t	gd�gd�d	�tddtjgddgd���
�}tj||�y)N)rr r rrr!r!r!Trrr$)�namer)r:r9r:)��?��?r�)�counts�freqsrYr]�abcd)rr�)r:r9r:r)r�r�r�r)r8r9r:r8r9r:r:r9r8r8r8r7)r`r:r:)g]t�E�?�t�E]t�?r�r8r9)r8r9r8)r�g�?r�)r$r�)r�describerrrr�assert_frame_equalrhr�rrGr�)r�factor�desc�	exp_indexrOr4s      r�
test_describez*TestCategoricalAPIWithFactor.test_describe�s����E�t�T����� ���~�~��~�$��,����
�	�� �+F�G�y�
��	���d�H�-��k�k�m��� � �!5�6���|�|�~��$���L�&�.�.�|�
�	��#�.L�M��
��	���d�H�-��;�<���|�|�~��$�Y����,�W�	�� �+I�J��
��	���d�H�-��2�6�6�1�a��+�,���|�|�~��� �+F�G�"��A�r�v�v��A�q�6���
��	���d�H�-r*N)r�r�r�r�r�r*rr�r��s��/.r*r�c��eZdZd�Zej
j
dddgddgddgddgfddgddgddgddgfddgddgddgddgfddgddgddgddgfgd�ddggd�gd�fgd	�gd�ddggd
�fgd�gd�gd�gd�fgd�gd�dggd�fgd�gd�d
ggd�fgd�gd�ggd�fddggddgddgfddgddgddgddgfg�d��Zd�Zy)�TestPrivateCategoricalAPIc���tddddtjg�}tjgd�d��}t	j
|j|�trdnd}tjt|�	�5tjgd
�d��|_ddd�|j}tjtd�	�5d|d
<ddd�d|d
<tjgd�d��}t	j
|j|�d|jd
<tjgd�d��}t	j
|j|�y#1swY��xYw#1swY��xYw)Nrr r!)rr8r9rr�r�r;z6property 'codes' of 'Categorical' object has no setterr-r)rr8r9rr8z#assignment destination is read-onlyr8rS)rr8r9rrr9)rr8r9rr9)
rrGr�rHrrEr�rr1r2r3rUr�)rr!r�rr�s     r�test_codes_immutablez.TestPrivateCategoricalAPI.test_codes_immutable�s"����c�3��R�V�V�4�5���h�h�'�v�6��
�#�#�A�G�G�S�1�
�
E�&�	�
�]�]�>��
5�	>��h�h��f�=�A�G�	>�����
�]�]�:�-R�
S�	��E�!�H�	�
��!���h�h��f�5��
�#�#�A�G�G�S�1��������h�h��f�5��
�#�#�A�G�G�S�1�!	>�	>��	�	�s�=E �E,� E)�,E5zcodes, old, new, expectedrr8rr )rr8rr8r)rr8r9r9)rr8r�r�)rr8r�)r�rr�r^)r�r�r�r�c�
�tj|tj��}tj|tj��}t|�}t|�}t	|||�}tj||�y)Nr;)rG�
asanyarrayr�rr
rrE)rr�rkrlrOrNs      r�test_recode_to_categoriesz3TestPrivateCategoricalAPI.test_recode_to_categories�s\��$�
�
�e�2�7�7�3���=�=�����9���C�j���C�j��&�u�c�3�7��
�#�#�F�H�5r*c��d}tj|�}t|�}tj|dz
ddtj��}t|�}t	|||�}tj||�y)Ni�r8r�r;)rG�aranger�int16r
rrE)r�Nr�rkrOrlrNs       r�test_recode_to_categories_largez9TestPrivateCategoricalAPI.test_recode_to_categories_large�s`�����	�	�!����E�l���9�9�Q��U�B��"�(�(�;���H�o��&�u�c�3�7��
�#�#�F�H�5r*N)	r�r�r�r�r1r�r�r�r�r�r*rr�r��s/��2�<�[�[���#���V�c�3�Z�#�s��a��V�4���V�c�3�Z�#�s��a��V�4���V�c�3�Z�#�s��a��V�4���V�c�3�Z�#�s��a��V�4�
�C��:���E�
�?�S�#�J��G�
��/�:�F�
��3�%��=�
��3�%��>�
��"�l�;��"�X�r�C��:��B�x�0���V�c�3�Z�#�s��a��V�4�
	
��"6�#�"6�6r*r�)rw�numpyrGr1�
pandas.compatr�pandasrrrrrr	�pandas._testing�_testingr�pandas.core.arrays.categoricalr
rr�r�r�r*r�<module>r�sE��	��
�����@�l,�l,�^0.�0.�f?6�?6r*

Youez - 2016 - github.com/yon3zu
LinuXploit