| 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/extension/base/__pycache__/ |
Upload File : |
�
/ �g � �Z � d dl Zd dlZd dlmc mZ d dlZd dl m
Z d dlm
Z
G d� d� Zy)� N)�
NumpyBlockc
� � e Zd ZdZd� Zd� Zd� Zd� Zej j dd ej d ej d � �
� g� d� � Zd� Zd
� Zej j dddg� d� � Zy)�BaseCastingTestsz#Casting to and from ExtensionDtypesc �" � t j |d�� }|j t � }|j t j t � k( sJ �t
|j d� r9|j j d }t |t � sJ �|j sJ �t |j j t
j � sJ �|j j j t j t � k( sJ �y )N�A)�name�blocksr )�pd�Series�astype�object�dtype�np�hasattr�_mgrr �
isinstancer � is_object�array�ndarray)�self�all_data�ser�result�blks �EC:\Python312\Lib\site-packages\pandas/tests/extension/base/casting.py�test_astype_object_seriesz*BaseCastingTests.test_astype_object_series s� � ��i�i��s�+�����F�#���|�|�r�x�x��/�/�/�/��6�;�;��)��+�+�$�$�Q�'�C��c�:�.�.�.��=�=� �=��&�+�+�+�+�R�Z�Z�8�8�8��{�{� � �&�&�"�(�(�6�*:�:�:�:� c �P � t j d|i� }|j t � }t |j
d� rG|j
j d }t |t � sJ t |� � �|j sJ �t |j
j d t j � sJ �|j
j d j t j t � k( sJ �|j |j k( }|j! � rJ �y )Nr r r )r
� DataFramer r
r r r r r �typer �arraysr r r �dtypes�any)r r �dfr r �comps r �test_astype_object_framez)BaseCastingTests.test_astype_object_frame s� � �
�\�\�3��/�
*�����6�"���6�;�;��)��+�+�$�$�Q�'�C��c�:�.�9��S� �9�.��=�=� �=��&�+�+�,�,�Q�/����<�<�<��{�{�!�!�!�$�*�*�b�h�h�v�.>�>�>�>� �}�}�� � �)���8�8�:��~�:r c �n � t j |� j � }t |� }||k( sJ �y �N)r
r �tolist�list)r �datar �expecteds r �test_tolistzBaseCastingTests.test_tolist( s/ � ����4��'�'�)����:����!�!�!r c � � t j |d d � j t � }t j |d d D �cg c]
}t |� �� c}t �� }t j
||� y c c}w �N� )r )r
r r �str�tm�assert_series_equal)r r+ r �xr, s r �test_astype_strz BaseCastingTests.test_astype_str- s[ � ����4���8�$�+�+�C�0���9�9�d�2�A�h�7��c�!�f�7�s�C��
���v�x�0�� 8s �A8�nullable_string_dtypezstring[python]zstring[pyarrow]�pyarrow)�marksc �* � t j |d d � j |� }t j |d d D �cg c]- }t |t � st |� n|j
� ��/ c}|�� }t j ||� y c c}w r/ ) r
r r r �bytesr1 �decoder2 r3 )r r+ r6 r r4 r, s r �test_astype_stringz#BaseCastingTests.test_astype_string2 sy � � ���4���8�$�+�+�,A�B���9�9�IM�b�q��R�A�:�a��/�S��V�Q�X�X�Z�
?�R�'�
�� ���v�x�0��
Ss �2Bc �� � t j |� }|j � }t j ||� t j |� j � }t j ||� y r( )r �asarray�to_numpyr2 �assert_equalr
r )r r+ r, r s r �
test_to_numpyzBaseCastingTests.test_to_numpyB sM � ��:�:�d�#�������
�����)����4��)�)�+��
�����)r c �z � t j � }|j |� }t j ||� y r( )r
r r r2 �assert_frame_equal)r r r$ r s r �test_astype_empty_dataframez,BaseCastingTests.test_astype_empty_dataframeK s+ � �
�\�\�^�����5�!��
���f�b�)r �copyTFc �| � |j |j |�� }||u | u sJ �t j ||� y )N)rE )r r r2 �assert_extension_array_equal)r r+ rE r s r �test_astype_own_typez%BaseCastingTests.test_astype_own_typeQ s>