| 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/interchange/__pycache__/ |
Upload File : |
�
- �g�D � �* � d dl mZ d dlmZmZ d dlZd dlmZ d dl m
Z
d dlmZ d dl
mZ d dlmZ d dlZd d lmZmZ d d
lmZ d dlmZmZ d dlmZmZmZmZ d d
lm Z m!Z!m"Z" erd dlm#Z# ejH ejJ ejL ejN ejP ejR ejR d�Z*ejL ejV dfejR ejX e
fejH ejZ dfejJ ejZ dfejN ejZ dfej\ ejX dfejP ej^ d fiZ0ejZ dejV dejX diZ1 G d� de� Z2y)� )�annotations)�
TYPE_CHECKING�AnyN)�infer_dtype)�iNaT)�NoBufferPresent)�cache_readonly)�BaseMaskedDtype)�
ArrowDtype�DatetimeTZDtype)�is_string_dtype)�PandasBuffer�PandasBufferPyarrow)�Column�
ColumnBuffers�ColumnNullType� DtypeKind)�ArrowCTypes�
Endianness�dtype_to_arrow_c_fmt)�Buffer)�i�u�f�b�U�M�m���zThis column is non-nullablezThis column uses NaN as nullz!This column uses a sentinel valuec �� � e Zd ZdZddd�Zdd�Zedd�� Zedd�� Z dd�Z
ed� � Zed� � Zedd �� Z
edd
�� Zdd�Zddd
�Zdd�Z dd�Zdd�Zdd�Zy)�PandasColumna�
A column object, with only the methods and properties required by the
interchange protocol defined.
A column can contain one or more chunks. Each chunk can contain up to three
buffers - a data buffer, a mask buffer (depending on null representation),
and an offsets buffer (if variable-size binary; e.g., variable-length
strings).
Note: this Column object can only be produced by ``__dataframe__``, so
doesn't need its own version or ``__column__`` protocol.
c �� � t |t j � rt d|j � d�� �t |t j
� st
dt |� � d�� �|| _ || _ y)zu
Note: doesn't deal with extension arrays yet, just assume a regular
Series/ndarray for now.
z�Expected a Series, got a DataFrame. This likely happened because you called __dataframe__ on a DataFrame which, after converting column names to string, resulted in duplicated names: zD. Please rename these columns before using the interchange protocol.zColumns of type � not handled yetN)
�
isinstance�pd� DataFrame� TypeError�columns�Series�NotImplementedError�type�_col�_allow_copy)�self�column�
allow_copys �@C:\Python312\Lib\site-packages\pandas/core/interchange/column.py�__init__zPandasColumn.__init__T su � �
�f�b�l�l�+��� !�.�.�)� *2�2��
� �&�"�)�)�,�%�(8��f���FV�&W�X�X� �� �%��� c �. � | j j S )z2
Size of the column, in elements.
)r, �size�r. s r1 r5 zPandasColumn.sizeh s � � �y�y�~�~�r3 c � � y)z7
Offset of first element. Always zero.
r � r6 s r1 �offsetzPandasColumn.offsetn s � � r3 c � � | j j }t |t j � rb| j j
j }| j |j � \ }}}}t j ||t j fS t |� rMt | j � dv r+t j dt |� t j fS t! d� �| j |� S )N)�string�empty� z.Non-string object dtypes are not supported yet)r, �dtyper$ r% �CategoricalDtype�values�codes�_dtype_from_pandasdtyper �CATEGORICALr �NATIVEr
r �STRINGr r* )r. r>