| 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/core/internals/__pycache__/ |
Upload File : |
�
- �gÄ � �^ � d Z ddlmZ ddlmZ ddlmZmZ ddlZ ddlm
Z
ddlmZ ddl
mZ dd lmZ dd
lmZmZmZmZmZ ddlmZmZmZmZmZ ddlmZ dd
lm Z m!Z! ddl"m#Z#m$Z% ddl&m'Z' ddl(m)Z) ddl*m+Z,m-Z-m.Z.m/Z/m0Z0 ddl1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8 ddl9m:Z:m;Z; ddl<m=Z=m>Z>m?Z?m@Z@ ddlAmBZBmCZCmDZDmEZE erddlFmGZGmHZH ddlImJZJmKZKmLZLmMZM ddddd� d3d�ZN d4d�ZOd5d6d�ZP d7d�ZQ d8d�ZRdddd � d9d!�ZS d:d"�ZTd;d#�ZUd5d<d$�ZVd=d%�ZW d>d&�ZXd?d'�ZY d@d(�ZZd?d)�Z[ dAd*�Z\d+� Z] dB dCd,�Z^dDd-�Z_ dEd.�Z` dFd/�Za dGd0�Zb dHd1�Zc dI dJd2�Zdy)Kz~
Functions for preparing various inputs passed to the DataFrame or Series
constructors before passing them to a BlockManager.
� )�annotations)�abc)�
TYPE_CHECKING�AnyN)�ma)�using_pyarrow_string_dtype)�lib)�astype_is_view)�"construct_1d_arraylike_from_scalar�dict_compat�maybe_cast_to_datetime�maybe_convert_platform�maybe_infer_to_datetimelike)�is_1d_only_ea_dtype�is_integer_dtype�is_list_like�is_named_tuple�is_object_dtype)�ExtensionDtype)�ABCDataFrame� ABCSeries)�
algorithms�common)�ExtensionArray)�StringDtype)�array�ensure_wrapped_if_datetimelike�
extract_array�range_to_ndarray�sanitize_array)�
DatetimeIndex�Index�TimedeltaIndex�
default_index�ensure_index�get_objs_combined_axis�
union_indexes)�ArrayManager�SingleArrayManager)�BlockPlacement�ensure_block_shape� new_block�new_block_2d)�BlockManager�SingleBlockManager� create_block_manager_from_blocks�'create_block_manager_from_column_arrays)�Hashable�Sequence)� ArrayLike�DtypeObj�Manager�nptT)�dtype�verify_integrity�typ�consolidatec �J � |r*|�t | � }nt |� }t | ||� \ } }n�t |� }| D �cg c] }t |d�� �� } }dgt | � z }| D ]S } t | t j t f� r'| j dk7 st | � t |� k7 s�Jt d� � t |� }t |� t | � k7 rt d� �||g}
|dk( rt | |
||�� S |d k( rt | ||g� S t d
|� d�� �c c}w )zs
Segregate Series based on type and coerce into matrices.
Needs to handle a lot of exceptional cases.
NT��
extract_numpy� zYArrays must be 1-dimensional np.ndarray or ExtensionArray with length matching len(index)z#len(arrays) must match len(columns)�block)r; �refsr �2'typ' needs to be one of {'block', 'array'}, got '�')
�_extract_indexr% �_homogenizer �len�
isinstance�np�ndarrayr �ndim�
ValueErrorr1 r( )�arrays�columns�indexr8 r9 r: r; rA �x�arr�axess �DC:\Python312\Lib\site-packages\pandas/core/internals/construction.py�
arrays_to_mgrrS ` sD � � ��=�"�6�*�E� ��'�E� #�6�5�%�8���� �U�#��@F�G�1�-���6�G��G��v��F��#�� � �C��s�R�Z�Z��$@�A��8�8�q�=��s�8�s�5�z�)� �6�� �
� �7�#�G�
�7�|�s�6�{�"��>�?�?�
�U��D�
�g�~�6��D�k��
�
�
����F�U�G�$4�5�5��O�PS�u�TU�V�W�W��= Hs �D c �, � t j | � }|�t t |� � }nt |� }|�t |� }t ||� \ }}t
|||t |� � \ }}|�|}t |||||�� } |r| j � } | S )zA
Extract from a masked rec array and create the manager.
�r8 r: ) r �getdatar$ rF r% � to_arrays�reorder_arraysrS �copy)
�datarN rM r8 rY r: �fdatarL �arr_columns�mgrs
rR �rec_array_to_mgrr^ � s� � �
�J�J�t��E��}��c�%�j�)���U�#�����w�'��#�E�7�3��F�K� )���g�s�5�z�R��F�K�����
����e��
E�C���h�h�j���J� c � � |dk( r�t | t � r| }|S | j dk( r5t | j | j
d | j
d d�� }|S t
j | j d | j � }|S |dk( r�t | t � r| }|S | j dk( r�t t | j
d � � D �cg c] }| j |� �� }}|r|D �cg c] }|j � �� }}t || j
d | j
d g� }|S | j � }|r|j � }t |g| j g� }|S t! d|� d�� �c c}w c c}w ) z�
Convert to specific type of Manager. Does not copy if the type is already
correct. Does not guarantee a copy otherwise. `copy` keyword only controls
whether conversion from Block->ArrayManager copies the 1D arrays.
r@ � r r? )r: r rB rC )rG r. rJ rS rL rQ r/ �
from_arrayrN r( �rangerF �iget_valuesrY �internal_valuesr) rK )r] r: rY �new_mgr�irL rP r s rR �
mgr_to_mgrrh � s| � � �g�~��c�<�(��G�0 �N�- �x�x�1�}�'��J�J������S�X�X�a�[�g���* �N�# -�7�7��
�
�1�
�s�y�y�Q��"