
    ch!                    P    S SK Jr  S SKJrJrJrJr  S SKrS SK	J
r
   " S S5      rg)    )annotations)AnyIterableOptionalSequenceN)_PyArrowColumnc                      \ rS rSrSr  S       SS jjr S     SS jjr\SS j5       rSS jr	SS jr
SS jrSS	 jrSS
 jrSS jrSS jrSS jr    SS jr S   SS jjrSrg)_PyArrowDataFrame   a
  
A data frame class, with only the methods required by the interchange
protocol defined.

A "data frame" represents an ordered collection of named columns.
A column's "name" must be a unique string.
Columns may be accessed by name or by position.

This could be a public data frame class, or an object with the methods and
attributes defined on this DataFrame class could be returned from the
``__dataframe__`` method of a public data frame class in a library adhering
to the dataframe interchange protocol specification.
c                H    Xl         USL a  [        S5      eX l        X0l        g)z
Constructor - an instance of this (private) class is returned from
`pa.Table.__dataframe__` or `pa.RecordBatch.__dataframe__`.
TzKnan_as_null=True currently has no effect, use the default nan_as_null=FalseN)_dfRuntimeError_nan_as_null_allow_copy)selfdfnan_as_null
allow_copys       pC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\pyarrow/interchange/dataframe.py__init___PyArrowDataFrame.__init__.   s3      $4  (%    c                .    [        U R                  X5      $ )aA  
Construct a new exchange object, potentially changing the parameters.
``nan_as_null`` is a keyword intended for the consumer to tell the
producer to overwrite null values in the data with ``NaN``.
It is intended for cases where the consumer does not support the bit
mask or byte mask that is the producer's native representation.
``allow_copy`` is a keyword that defines whether or not the library is
allowed to make a copy of the data. For example, copying data would be
necessary if a library supports strided buffers, given that this
protocol specifies contiguous buffers.
)r
   r   )r   r   r   s      r   __dataframe___PyArrowDataFrame.__dataframe__C   s     !;CCr   c                (   U R                   R                  R                  (       af  U R                   R                  R                  R                  5        VVs0 s H)  u  pSUR	                  S5      -   UR	                  S5      _M+     nnnU$ 0 $ s  snnf )a  
The metadata for the data frame, as a dictionary with string keys. The
contents of `metadata` may be anything, they are meant for a library
to store information that it needs to, e.g., roundtrip losslessly or
for two implementations to share data that is not (yet) part of the
interchange protocol specification. For avoiding collisions with other
entries, please add name the keys with the name of the library
followed by a period and the desired name, e.g, ``pandas.indexcol``.
zpyarrow.utf8)r   schemametadataitemsdecode)r   kvschema_metadatas       r   r   _PyArrowDataFrame.metadataS   s}     88??##+/88??+C+C+I+I+KM+K41  *AHHV,<<ahhv>NN+K  M""I	Ms   0Bc                .    U R                   R                  $ )z0
Return the number of columns in the DataFrame.
)r   num_columnsr   s    r   r'   _PyArrowDataFrame.num_columnsg   s     xx###r   c                .    U R                   R                  $ )z;
Return the number of rows in the DataFrame, if available.
)r   num_rowsr(   s    r   r+   _PyArrowDataFrame.num_rowsm   s     xx   r   c                    [        U R                  [        R                  5      (       a  gU R                  R	                  5       n[        U5      $ )z8
Return the number of chunks the DataFrame consists of.
   )
isinstancer   paRecordBatch
to_batcheslen)r   batchess     r   
num_chunks_PyArrowDataFrame.num_chunkss   s:     dhh// hh))+Gw<r   c                B    U R                   R                  R                  $ )z/
Return an iterator yielding the column names.
)r   r   namesr(   s    r   column_names_PyArrowDataFrame.column_names   s     xx$$$r   c                \    [        U R                  R                  U5      U R                  S9$ )z.
Return the column at the indicated position.
r   r   r   columnr   )r   is     r   
get_column_PyArrowDataFrame.get_column   s)     dhhooa0)-)9)9; 	;r   c                \    [        U R                  R                  U5      U R                  S9$ )z5
Return the column whose name is the indicated name.
r<   r=   )r   names     r   get_column_by_name$_PyArrowDataFrame.get_column_by_name   s)     dhhood3)-)9)9; 	;r   c                |    U R                   R                   Vs/ s H  n[        XR                  S9PM     sn$ s  snf )z*
Return an iterator yielding the columns.
r<   )r   columnsr   r   )r   cols     r   get_columns_PyArrowDataFrame.get_columns   s>     xx''
' 3+;+;<'
 	
 
s   9c                    [        U R                  R                  [        U5      5      U R                  U R
                  5      $ )zC
Create a new DataFrame by selecting a subset of columns by index.
r
   r   selectlistr   r   )r   indicess     r   select_columns _PyArrowDataFrame.select_columns   s5     !HHOODM*D,=,=t?O?O
 	
r   c                    [        U R                  R                  [        U5      5      U R                  U R
                  5      $ )zB
Create a new DataFrame by selecting a subset of columns by name.
rL   )r   r8   s     r   select_columns_by_name(_PyArrowDataFrame.select_columns_by_name   s5     !HHOODK($*;*;T=M=M
 	
r   Nc                2   U(       Ga  US:  Ga   U R                  5       U-  nU R                  5       U-  S:w  a  US-  n[        U R                  [        R                  5      (       a  U R                  R                  US9nOB/ n[        SX!-  U5       H-  nUR                  U R                  R                  XB5      5        M/     [        U5      US-
  :X  a9  UR                  [        R                  " / /U R                  R                  S95        OQ[        U R                  [        R                  5      (       a  U R                  R                  5       nOU R                  /nU Vs/ s H$  n[        UU R                  U R                  5      PM&     nnU$ s  snf )aQ  
Return an iterator yielding the chunks.

By default (None), yields the chunks that the data is stored as by the
producer. If given, ``n_chunks`` must be a multiple of
``self.num_chunks()``, meaning the producer must subdivide each chunk
before yielding it.

Note that the producer must ensure that all columns are chunked the
same way.
r.   r   )max_chunksize)r   )r+   r/   r   r0   Tabler2   rangeappendslicer3   record_batchr   r
   r   r   )r   n_chunks
chunk_sizer4   startbatchiterators          r   
get_chunks_PyArrowDataFrame.get_chunks   sM    1H4J}})Q.a
$((BHH--((--J-G"1j&;ZHENN488>>%#DE I 7|x!|+rtDHHOOLM $((BHH--((--/88* ")* ") &e&*&7&7&*&6&68 ") 	 * 	*s   %+F)r   r   r   )FT)r   zpa.Table | pa.RecordBatchr   boolr   rc   returnNone)r   rc   r   rc   rd   r
   )rd   zdict[str, Any])rd   int)rd   zIterable[str])r?   rf   rd   r   )rC   strrd   r   )rd   zIterable[_PyArrowColumn])rO   zSequence[int]rd   r
   )r8   zSequence[str]rd   r
   )N)r\   zOptional[int]rd   zIterable[_PyArrowDataFrame])__name__
__module____qualname____firstlineno____doc__r   r   propertyr   r'   r+   r5   r9   r@   rD   rI   rP   rS   ra   __static_attributes__ r   r   r
   r
      s      "&+&& & 
	&, =ADD59D	D   &$! %;;


"
	
 )-)%)	$) )r   r
   )
__future__r   typingr   r   r   r   pyarrowr0   pyarrow.interchange.columnr   r
   ro   r   r   <module>rt      s(   $ #   5z zr   