
    \
qiX             
      J   U d Z ddlmZ ddlmZ ddlZddlmZmZ ddl	Z	ddl
Z
ddlZddlmZ ddlmZmZmZmZmZmZmZmZ ddlZddlZddlmZmZmZ dd	lmZm Z! dd
l"m#Z# ddl$m%Z% ddl&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3m4Z4 ddl5m6Z6 ddl7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z= ddl>m?Z?m@Z@mAZAmBZB ddlCmDZD ddlEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZP ddlQmRZRmSZSmTZT ddlUmVZV ddlWmXZX ddlYmZc m[Z\ ddl]m^Z^m_Z_ ddl`maZbmcZc ddldmeZe ddlfmgZg ddlhmiZimjZj er6ddlkmlZlmmZmmnZnmoZo ddlpmqZqmrZr dd lsmtZtmuZumvZv dd!lwmxZxmyZymzZzm{Z{m|Z|m}Z}m~Z~ dd"lmZ d#Zd$Zdd)Zd* Ze^Zd+ed,<   dd/Zd0Zd1ed2<   d3Zd1ed4<   d5Zd1ed6<   d7d7d8d8d9ZeFdgiZd:Zd1ed;<   d<Zd1ed=<    ej        d>          5   ej        d?d@eej        A            ej        dBde ej        g dC          A           ddd           n# 1 swxY w Y   dadDedE<   d@adF Z	 	 	 	 	 	 	 	 	 	 	 	 ddd_Z e4d`          	 	 	 	 	 	 	 	 	 dddj            ZddnZ e4d`           G do dp                      Z G dq dr          Z G ds dt          Z G du dve          Z G dw dxe          Z G dy dze          Z G d{ d|e          Z G d} d~          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z	 dddZddZddZddZddZddZddZddZddZddZddZddZddZddZ G d d          ZdS )zY
High level interface to PyTables for reading and writing pandas data structures
to disk
    )annotations)suppressN)datetzinfo)dedent)TYPE_CHECKINGAnyFinalLiteralSelf	TypeAliascastoverload)config
get_optionusing_string_dtype)libwriters)is_string_array)	timezones)HAS_PYARROW)import_optional_dependency)patch_pickle)AttributeConflictWarningClosedFileErrorIncompatibilityWarningPerformanceWarningPossibleDataLossError)cache_readonly
set_module)find_stack_level)ensure_objectis_bool_dtypeis_complex_dtypeis_list_likeis_string_dtypeneeds_i8_conversion)CategoricalDtypeDatetimeTZDtypeExtensionDtypePeriodDtype)array_equivalent)	DataFrameDatetimeIndexIndex
MultiIndexPeriodIndex
RangeIndexSeriesStringDtypeTimedeltaIndexconcatisna)CategoricalDatetimeArrayPeriodArray)tz_to_dtype)BaseStringArray)PyTablesExprmaybe_expression)arrayextract_array)ensure_index)stringify_path)adjoinpprint_thing)CallableHashableIteratorSequence)
ModuleTypeTracebackType)ColFileNode)AnyArrayLike	ArrayLikeAxisIntDtypeArgFilePathTimeUnitnpt)Blockz0.15.2UTF-8encoding
str | Nonereturnstrc                    | t           } | S N)_default_encodingrW   s    r/var/www/html/bestrading.cuttalo.com/services/ml-inference/venv/lib/python3.11/site-packages/pandas/io/pytables.py_ensure_encodingr`      s    $O    c                N    t          | t                    rt          |           } | S )z
    Ensure that an index / column name is a str (python 3); otherwise they
    may be np.string dtype. Non-string dtypes are passed through unchanged.

    https://github.com/pandas-dev/pandas/issues/13492
    )
isinstancerZ   names    r_   _ensure_strrf      s&     $ 4yyKra   r   Termscope_levelintc                    |dz   t          | t          t          f          rfd| D             } n t          |           rt	          |           } | t          |           r| ndS )z
    Ensure that the where is a Term or a list of Term.

    This makes sure that we are capturing the scope of variables that are
    passed create the terms here with a frame_level=2 (we are 2 levels down)
       c                ^    g | ])}|t          |          rt          |dz             n|*S )Nrk   rh   )r>   rg   ).0termlevels     r_   
<listcomp>z _ensure_term.<locals>.<listcomp>   sM     
 
 
 2B$1G1GQD519----Tra   rm   N)rc   listtupler>   rg   len)whererh   rp   s     @r_   _ensure_termrv      s     !OE%$'' /
 
 
 

 
 

 
%	 	  /U...MSZZM55T9ra   z
where criteria is being ignored as this version [%s] is too old (or
not-defined), read the file in and write it out to a new file to upgrade (with
the copy_to method)
r
   incompatibility_doczu
the [%s] attribute of the existing index is [%s] which conflicts with the new
[%s], resetting the attribute to None
attribute_conflict_docz
your performance may suffer as PyTables will pickle object types that it cannot
map directly to c-types [inferred_type->%s,key->%s] [items->%s]
performance_docfixedtable)frz   tr{   z;
: boolean
    drop ALL nan rows when appending to a table

dropna_docz~
: format
    default format writing format, if None, then
    put will default to 'fixed' and append will default to 'table'

format_doczio.hdfdropna_tableF)	validatordefault_format)rz   r{   NzModuleType | None
_table_modc                     t           Bdd l} | a t          t                    5  | j        j        dk    ad d d            n# 1 swxY w Y   t           S )Nr   strict)r   tablesr   AttributeErrorfile_FILE_OPEN_POLICY!_table_file_open_policy_is_strict)r   s    r_   _tablesr      s     

 n%% 	 	-9 .	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 s   ?AAaTr   path_or_bufFilePath | HDFStorekeyvalueDataFrame | Seriesmode	complevel
int | Nonecomplibappendboolformatindexmin_itemsizeint | dict[str, int] | Nonedropnabool | Nonedata_columns Literal[True] | list[str] | NoneerrorsNonec           
     (  	
 |r	
f
d}n	
f
d}t          | t                    r ||            dS t          |           } t          | |||          5 } ||           ddd           dS # 1 swxY w Y   dS )z+store this object, close it if we opened itc                B   
 |                      
	
  
        S )N)r   r   r   nan_repr   r   r   rW   )r   storer   r   rW   r   r   r   r   r   r   r   s    r_   <lambda>zto_hdf.<locals>.<lambda>  s8    %,,%% ' 
 
 ra   c                B   
 |                      
	
  
        S )N)r   r   r   r   r   r   rW   r   putr   s    r_   r   zto_hdf.<locals>.<lambda>(  s8    %))%% $ 
 
 ra   )r   r   r   N)rc   HDFStorerB   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   rW   r|   r   s    ``    ````````  r_   to_hdfr     s]   $  

 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 +x(( 	+$[11di
 
 
 	AeHHH	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   .BBBpandasrru   str | list | Nonestartstopcolumnslist[str] | Noneiterator	chunksizec
           
        |dvrt          d| d          |t          |d          }t          | t                    r| j        st          d          | }d}nt          |           } t          | t                    st          d	          	 t          j
                            |           }n# t          t           f$ r d}Y nw xY w|st          d
|  d          t          | f||d|
}d}	 |q|                                }t          |          dk    rt          d          |d         }|dd         D ]!}t!          ||          st          d          "|j        }|                    |||||||	|          S # t           t          t&          f$ rW t          | t                    s@t)          t*                    5  |                                 ddd           n# 1 swxY w Y    w xY w)a>
  
    Read from the store, close it if we opened it.

    Retrieve pandas object stored in file, optionally based on where
    criteria.

    .. warning::

       Pandas uses PyTables for reading and writing HDF5 files, which allows
       serializing object-dtype data with pickle when using the "fixed" format.
       Loading pickled data received from untrusted sources can be unsafe.

       See: https://docs.python.org/3/library/pickle.html for more.

    Parameters
    ----------
    path_or_buf : str, path object, pandas.HDFStore
        Any valid string path is acceptable. Only supports the local file system,
        remote URLs and file-like objects are not supported.

        If you want to pass in a path object, pandas accepts any
        ``os.PathLike``.

        Alternatively, pandas accepts an open :class:`pandas.HDFStore` object.

    key : object, optional
        The group identifier in the store. Can be omitted if the HDF file
        contains a single pandas object.
    mode : {'r', 'r+', 'a'}, default 'r'
        Mode to use when opening the file. Ignored if path_or_buf is a
        :class:`pandas.HDFStore`. Default is 'r'.
    errors : str, default 'strict'
        Specifies how encoding and decoding errors are to be handled.
        See the errors argument for :func:`open` for a full list
        of options.
    where : list, optional
        A list of Term (or convertible) objects.
    start : int, optional
        Row number to start selection.
    stop : int, optional
        Row number to stop selection.
    columns : list, optional
        A list of columns names to return.
    iterator : bool, optional
        Return an iterator object.
    chunksize : int, optional
        Number of rows to include in an iteration when using an iterator.
    **kwargs
        Additional keyword arguments passed to HDFStore.

    Returns
    -------
    object
        The selected object. Return type depends on the object stored.

    See Also
    --------
    DataFrame.to_hdf : Write an HDF file from a DataFrame.
    HDFStore : Low-level access to HDF files.

    Notes
    -----
    When ``errors="surrogatepass"``, ``pd.options.future.infer_string`` is true,
    and PyArrow is installed, if a UTF-16 surrogate is encountered when decoding
    to UTF-8, the resulting dtype will be
    ``pd.StringDtype(storage="python", na_value=np.nan)``.

    Examples
    --------
    >>> df = pd.DataFrame([[1, 1.0, "a"]], columns=["x", "y", "z"])  # doctest: +SKIP
    >>> df.to_hdf("./store.h5", "data")  # doctest: +SKIP
    >>> reread = pd.read_hdf("./store.h5")  # doctest: +SKIP
    )r   r+r   zmode zG is not allowed while performing a read. Allowed modes are r, r+ and a.Nrk   rm   z&The HDFStore must be open for reading.Fz5Support for generic buffers has not been implemented.zFile z does not exist)r   r   Tr   z]Dataset(s) incompatible with Pandas data types, not table, or no datasets found in HDF5 file.z?key must be provided when HDF5 file contains multiple datasets.)ru   r   r   r   r   r   
auto_close)
ValueErrorrv   rc   r   is_openOSErrorrB   rZ   NotImplementedErrorospathexists	TypeErrorFileNotFoundErrorgroupsrt   _is_metadata_of_v_pathnameselectLookupErrorr   r   close)r   r   r   r   ru   r   r   r   r   r   kwargsr   r   r   r   candidate_only_groupgroup_to_checks                    r_   read_hdfr   ?  s   n ###.D . . .
 
 	

 U222+x(( " 	DBCCC

$[11+s++ 	%G  	W^^K00FF :& 	 	 	FFF	  	J#$HK$H$H$HIIII4II&II 
%;\\^^F6{{a D   $*!9  #)*  &~7KLL $;  
 '2C||!  	
 	
 		
 	;/   +x00 	.))                 	sD   B/ /CC0BF   A G. G!G.!G%	%G.(G%	)G.grouprM   parent_groupc                    | j         |j         k    rdS | }|j         dk    r,|j        }||k    r|j        dk    rdS |j        }|j         dk    ,dS )zDCheck if a given group is a metadata group for a given parent_group.Frk   metaT)_v_depth	_v_parent_v_name)r   r   currentparents       r_   r   r     sm    ~...uG

Q

"\!!go&?&?4#	 
Q


 5ra   c                  v   e Zd ZU dZded<   ded<   	 	 	 	 dtdudZdvdZed             Zedvd            Z	dwdZ
dxdZdydZdzdZd{dZd|dZdvdZd}dZd~d&Zddd*Zdd,Zdd.Zddd/Zdd0Zedd1            Zddd3Zdwd4Z	 	 	 	 	 	 	 ddd8Z	 	 	 ddd;Z	 	 ddd=Z	 	 	 	 	 	 	 	 ddd>Z	 	 	 	 	 	 	 	 	 	 	 	 dddLZddydMZ 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dddPZ!	 	 	 dddSZ"	 	 	 dddWZ#ddYZ$ddd]Z%dd_Z&ddaZ'	 	 	 	 	 	 	 dddeZ(dvdfZ)ddgZ*ddiZ+	 	 	 	 dddmZ,	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dddnZ-ddqZ.ddrZ/ddsZ0dS )r   aP	  
    Dict-like IO interface for storing pandas objects in PyTables.

    Either Fixed or Table format.

    .. warning::

       Pandas uses PyTables for reading and writing HDF5 files, which allows
       serializing object-dtype data with pickle when using the "fixed" format.
       Loading pickled data received from untrusted sources can be unsafe.

       See: https://docs.python.org/3/library/pickle.html for more.

    Parameters
    ----------
    path : str
        File path to HDF5 file.
    mode : {'a', 'w', 'r', 'r+'}, default 'a'

        ``'r'``
            Read-only; no data can be modified.
        ``'w'``
            Write; a new file is created (an existing file with the same
            name would be deleted).
        ``'a'``
            Append; an existing file is opened for reading and writing,
            and if the file does not exist it is created.
        ``'r+'``
            It is similar to ``'a'``, but the file must already exist.
    complevel : int, 0-9, default None
        Specifies a compression level for data.
        A value of 0 or None disables compression.
    complib : {'zlib', 'lzo', 'bzip2', 'blosc'}, default 'zlib'
        Specifies the compression library to be used.
        These additional compressors for Blosc are supported
        (default if no compressor specified: 'blosc:blosclz'):
        {'blosc:blosclz', 'blosc:lz4', 'blosc:lz4hc', 'blosc:snappy',
         'blosc:zlib', 'blosc:zstd'}.
        Specifying a compression library which is not available issues
        a ValueError.
    fletcher32 : bool, default False
        If applying compression use the fletcher32 checksum.
    **kwargs
        These parameters will be passed to the PyTables open_file method.

    Examples
    --------
    >>> bar = pd.DataFrame(np.random.randn(10, 4))
    >>> store = pd.HDFStore("test.h5")
    >>> store["foo"] = bar  # write to HDF5
    >>> bar = store["foo"]  # retrieve
    >>> store.close()

    **Create or load HDF5 file in-memory**

    When passing the `driver` option to the PyTables open_file method through
    **kwargs, the HDF5 file is loaded or created in-memory and will only be
    written when closed:

    >>> bar = pd.DataFrame(np.random.randn(10, 4))
    >>> store = pd.HDFStore("test.h5", driver="H5FD_CORE")
    >>> store["foo"] = bar
    >>> store.close()  # only now, data is written to disk
    zFile | None_handlerZ   _moder   NFr   r   r   
fletcher32r   rY   r   c                n   d|v rt          d          t          d          }|+||j        j        vrt          d|j        j         d          |||j        j        }t          |          | _        |d}|| _        d | _        |r|nd| _	        || _
        || _        d | _         | j        d	d|i| d S )
Nr   z-format is not a defined argument for HDFStorer   zcomplib only supports z compression.r   r   r    )r   r   filtersall_complibsdefault_complibrB   _pathr   r   
_complevel_complib_fletcher32_filtersopen)selfr   r   r   r   r   r   r   s           r_   __init__zHDFStore.__init__6  s     vLMMM+H557&.2M#M#MS)DSSS   ?y4n4G#D))
<D
'07))a%	&&t&v&&&&&ra   c                    | j         S r\   r   r   s    r_   
__fspath__zHDFStore.__fspath__W  s
    zra   c                T    |                                   | j        J | j        j        S )zreturn the root node)_check_if_openr   rootr   s    r_   r   zHDFStore.rootZ  s/     	|'''|  ra   c                    | j         S r\   r   r   s    r_   filenamezHDFStore.filenamea  
    zra   r   c                ,    |                      |          S r\   )getr   r   s     r_   __getitem__zHDFStore.__getitem__e  s    xx}}ra   c                2    |                      ||           d S r\   r   )r   r   r   s      r_   __setitem__zHDFStore.__setitem__h  s    era   c                ,    |                      |          S r\   )remover   s     r_   __delitem__zHDFStore.__delitem__k  s    {{3ra   re   c                    	 |                      |          S # t          t          f$ r Y nw xY wt          dt	          |           j         d| d          )z$allow attribute access to get stores'z' object has no attribute ')r   KeyErrorr   r   type__name__)r   re   s     r_   __getattr__zHDFStore.__getattr__n  sm    	88D>>!/* 	 	 	D	GT

#GGGGG
 
 	
s    ++c                b    |                      |          }||j        }|||dd         fv rdS dS )zx
        check for existence of this key
        can match the exact pathname or the pathnm w/o the leading '/'
        Nrk   TF)get_noder   )r   r   nodere   s       r_   __contains__zHDFStore.__contains__x  sE    
 }}S!!#DtT!""X&&&tura   ri   c                D    t          |                                           S r\   )rt   r   r   s    r_   __len__zHDFStore.__len__  s    4;;==!!!ra   c                T    t          | j                  }t          |            d| dS )N
File path: 
)rD   r   r   )r   pstrs     r_   __repr__zHDFStore.__repr__  s.    DJ''t**3343333ra   r   c                    | S r\   r   r   s    r_   	__enter__zHDFStore.__enter__  s    ra   exc_typetype[BaseException] | None	exc_valueBaseException | None	tracebackTracebackType | Nonec                .    |                                   d S r\   )r   )r   r  r  r  s       r_   __exit__zHDFStore.__exit__  s     	

ra   r   include	list[str]c                    |dk    rd |                                  D             S |dk    r/| j        J d | j                            dd          D             S t          d	| d
          )af  
        Return a list of keys corresponding to objects stored in HDFStore.

        Parameters
        ----------

        include : str, default 'pandas'
                When kind equals 'pandas' return pandas objects.
                When kind equals 'native' return native HDF5 Table objects.

        Returns
        -------
        list
            List of ABSOLUTE path-names (e.g. have the leading '/').

        Raises
        ------
        raises ValueError if kind has an illegal value

        See Also
        --------
        HDFStore.info : Prints detailed information on the store.
        HDFStore.get_node : Returns the node with the key.
        HDFStore.get_storer : Returns the storer object for a key.

        Examples
        --------
        >>> df = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"])
        >>> store = pd.HDFStore("store.h5", "w")  # doctest: +SKIP
        >>> store.put("data", df)  # doctest: +SKIP
        >>> store.get("data")  # doctest: +SKIP
        >>> print(store.keys())  # doctest: +SKIP
        ['/data1', '/data2']
        >>> store.close()  # doctest: +SKIP
        r   c                    g | ]	}|j         
S r   r   rn   ns     r_   rq   z!HDFStore.keys.<locals>.<listcomp>  s    999aAM999ra   nativeNc                    g | ]	}|j         
S r   r  r  s     r_   rq   z!HDFStore.keys.<locals>.<listcomp>  s'       "#  ra   /Table)	classnamez8`include` should be either 'pandas' or 'native' but is 'r   )r   r   
walk_nodesr   )r   r  s     r_   keyszHDFStore.keys  s    H h994;;==9999  <+++ '+|'>'>sg'>'V'V    QwQQQ
 
 	
ra   Iterator[str]c                D    t          |                                           S r\   )iterr!  r   s    r_   __iter__zHDFStore.__iter__  s    DIIKK   ra   Iterator[tuple[str, list]]c              #  N   K   |                                  D ]}|j        |fV  dS )z'
        iterate on key->group
        N)r   r   )r   gs     r_   itemszHDFStore.items  s?        	# 	#A-"""""	# 	#ra   c                   t                      }| j        |k    r@| j        dv r|dv rn+|dv r'| j        r t          d| j         d| j         d          || _        | j        r|                                  | j        rC| j        dk    r8t                                          | j        | j        | j	                  | _
        t          r| j        rd	}t          |           |j        | j        | j        fi || _        d
S )a9  
        Open the file in the specified mode

        Parameters
        ----------
        mode : {'a', 'w', 'r', 'r+'}, default 'a'
            See HDFStore docstring or tables.open_file for info about modes
        **kwargs
            These parameters will be passed to the PyTables open_file method.
        )r   w)r   r   )r+  zRe-opening the file [z] with mode [z] will delete the current file!r   )r   zGCannot open HDF5 file, which is already opened, even in read-only mode.N)r   r   r   r   r   r   r   Filtersr   r   r   r   r   	open_filer   )r   r   r   r   msgs        r_   r   zHDFStore.open  s6    :zZ''DK,?,?< /8
 8 8 8 8 8  
 DJ < 	JJLLL? 	t22#II--4;K .  DM - 	" 	"*  S//!'v'
DJII&IIra   c                T    | j         | j                                          d| _         dS )z0
        Close the PyTables file handle
        N)r   r   r   s    r_   r   zHDFStore.close  s+     <#L   ra   c                F    | j         dS t          | j         j                  S )zF
        return a boolean indicating whether the file is open
        NF)r   r   isopenr   s    r_   r   zHDFStore.is_open  s$    
 <5DL'(((ra   fsyncc                   | j         u| j                                          |r\t          t                    5  t	          j        | j                                                    ddd           dS # 1 swxY w Y   dS dS dS )a  
        Force all buffered modifications to be written to disk.

        Parameters
        ----------
        fsync : bool (default False)
          call ``os.fsync()`` on the file handle to force writing to disk.

        Notes
        -----
        Without ``fsync=True``, flushing may not guarantee that the OS writes
        to disk. With fsync, the operation will block until the OS claims the
        file has been written; however, other caching layers may still
        interfere.
        N)r   flushr   r   r   r2  fileno)r   r2  s     r_   r4  zHDFStore.flush  s      <#L    4g&& 4 4HT\00223334 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 $#4 4s   ,A00A47A4c                    t                      5  |                     |          }|t          d| d          |                     |          cddd           S # 1 swxY w Y   dS )a  
        Retrieve pandas object stored in file.

        Parameters
        ----------
        key : str
            Object to retrieve from file. Raises KeyError if not found.

        Returns
        -------
        object
            Same type as object stored in file.

        See Also
        --------
        HDFStore.get_node : Returns the node with the key.
        HDFStore.get_storer : Returns the storer object for a key.

        Examples
        --------
        >>> df = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"])
        >>> store = pd.HDFStore("store.h5", "w")  # doctest: +SKIP
        >>> store.put("data", df)  # doctest: +SKIP
        >>> store.get("data")  # doctest: +SKIP
        >>> store.close()  # doctest: +SKIP
        NNo object named  in the file)r   r   r   _read_groupr   r   r   s      r_   r   zHDFStore.get$  s    6 ^^ 	+ 	+ MM#&&E}C#CCCDDD##E**	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s   ?AA"Ar   r   r   c	                >   |                      |          }	|	t          d| d          t          |d          }|                     |	                                           fd}
t          | |
|j        |||||
  
        }|                                S )aC  
        Retrieve pandas object stored in file, optionally based on where criteria.

        .. warning::

           Pandas uses PyTables for reading and writing HDF5 files, which allows
           serializing object-dtype data with pickle when using the "fixed" format.
           Loading pickled data received from untrusted sources can be unsafe.

           See: https://docs.python.org/3/library/pickle.html for more.

        Parameters
        ----------
        key : str
            Object being retrieved from file.
        where : list or None
            List of Term (or convertible) objects, optional.
        start : int or None
            Row number to start selection.
        stop : int, default None
            Row number to stop selection.
        columns : list or None
            A list of columns that if not None, will limit the return columns.
        iterator : bool or False
            Returns an iterator.
        chunksize : int or None
            Number or rows to include in iteration, return an iterator.
        auto_close : bool or False
            Should automatically close the store when finished.

        Returns
        -------
        object
            Retrieved object from file.

        See Also
        --------
        HDFStore.select_as_coordinates : Returns the selection as an index.
        HDFStore.select_column : Returns a single column from the table.
        HDFStore.select_as_multiple : Retrieves pandas objects from multiple tables.

        Examples
        --------
        >>> df = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"])
        >>> store = pd.HDFStore("store.h5", "w")  # doctest: +SKIP
        >>> store.put("data", df)  # doctest: +SKIP
        >>> store.get("data")  # doctest: +SKIP
        >>> print(store.keys())  # doctest: +SKIP
        ['/data1', '/data2']
        >>> store.select("/data1")  # doctest: +SKIP
           A  B
        0  1  2
        1  3  4
        >>> store.select("/data1", where="columns == A")  # doctest: +SKIP
           A
        0  1
        1  3
        >>> store.close()  # doctest: +SKIP
        Nr7  r8  rk   rm   c                6                         | ||          S )N)r   r   ru   r   read)_start_stop_wherer   ss      r_   funczHDFStore.select.<locals>.func  s    66U&'6RRRra   ru   nrowsr   r   r   r   r   )r   r   rv   _create_storer
infer_axesTableIteratorrE  
get_result)r   r   ru   r   r   r   r   r   r   r   rC  itrB  s        `      @r_   r   zHDFStore.selectG  s    L c""=?c???@@@ U222&&		S 	S 	S 	S 	S 	S '!
 
 
 }}ra   r   r   c                    t          |d          }|                     |          }t          |t                    st	          d          |                    |||          S )a  
        return the selection as an Index

        .. warning::

           Pandas uses PyTables for reading and writing HDF5 files, which allows
           serializing object-dtype data with pickle when using the "fixed" format.
           Loading pickled data received from untrusted sources can be unsafe.

           See: https://docs.python.org/3/library/pickle.html for more.


        Parameters
        ----------
        key : str
        where : list of Term (or convertible) objects, optional
        start : integer (defaults to None), row number to start selection
        stop  : integer (defaults to None), row number to stop selection
        rk   rm   z&can only read_coordinates with a tableru   r   r   )rv   
get_storerrc   r  r   read_coordinates)r   r   ru   r   r   tbls         r_   select_as_coordinateszHDFStore.select_as_coordinates  sd    4 U222ooc""#u%% 	FDEEE##%u4#HHHra   columnc                    |                      |          }t          |t                    st          d          |                    |||          S )a~  
        return a single column from the table. This is generally only useful to
        select an indexable

        .. warning::

           Pandas uses PyTables for reading and writing HDF5 files, which allows
           serializing object-dtype data with pickle when using the "fixed" format.
           Loading pickled data received from untrusted sources can be unsafe.

           See: https://docs.python.org/3/library/pickle.html for more.

        Parameters
        ----------
        key : str
        column : str
            The column of interest.
        start : int or None, default None
        stop : int or None, default None

        Raises
        ------
        raises KeyError if the column is not found (or key is not a valid
            store)
        raises ValueError if the column can not be extracted individually (it
            is part of a data block)

        z!can only read_column with a table)rQ  r   r   )rM  rc   r  r   read_column)r   r   rQ  r   r   rO  s         r_   select_columnzHDFStore.select_column  sP    F ooc""#u%% 	A?@@@fEEEEra   c
                    t          |d          }t          |t          t          f          rt	          |          dk    r|d         }t          |t
                    r                     |||||||	          S t          |t          t          f          st          d          t	          |          st          d          ||d         } fd|D              	                    |          }
d}t          j        |
|fgt          |d	
                    D ]]\  }}|t          d| d          |j        st          d|j         d          ||j        }C|j        |k    rt          d          ^d D             }d |D                                             fd}t%           |
||||||||	
  
        }|                    d	          S )a  
        Retrieve pandas objects from multiple tables.

        .. warning::

           Pandas uses PyTables for reading and writing HDF5 files, which allows
           serializing object-dtype data with pickle when using the "fixed" format.
           Loading pickled data received from untrusted sources can be unsafe.

           See: https://docs.python.org/3/library/pickle.html for more.

        Parameters
        ----------
        keys : a list of the tables
        selector : the table to apply the where criteria (defaults to keys[0]
            if not supplied)
        columns : the columns I want back
        start : integer (defaults to None), row number to start selection
        stop  : integer (defaults to None), row number to stop selection
        iterator : bool, return an iterator, default False
        chunksize : nrows to include in iteration, return an iterator
        auto_close : bool, default False
            Should automatically close the store when finished.

        Raises
        ------
        raises KeyError if keys or selector is not found or keys is empty
        raises TypeError if keys is not a list or tuple
        raises ValueError if the tables are not ALL THE SAME DIMENSIONS
        rk   rm   r   )r   ru   r   r   r   r   r   r   zkeys must be a list/tuplez keys must have a non-zero lengthNc                :    g | ]}                     |          S r   )rM  )rn   kr   s     r_   rq   z/HDFStore.select_as_multiple.<locals>.<listcomp>6  s%    111q""111ra   Tr   zInvalid table []zobject [z>] is not a table, and cannot be used in all select as multiplez,all tables must have exactly the same nrows!c                <    g | ]}t          |t                    |S r   )rc   r  rn   xs     r_   rq   z/HDFStore.select_as_multiple.<locals>.<listcomp>K  s'    999qJq%$8$89999ra   c                4    h | ]}|j         d          d          S r   )non_index_axes)rn   r}   s     r_   	<setcomp>z.HDFStore.select_as_multiple.<locals>.<setcomp>N  s%    6661 #A&666ra   c                t      fdD             }t          |d                                          S )Nc                B    g | ]}|                                S )ru   r   r   r   r=  )rn   r}   r?  r@  rA  r   s     r_   rq   z=HDFStore.select_as_multiple.<locals>.func.<locals>.<listcomp>S  s=        VWFOO  ra   F)axisverify_integrity)r6   _consolidate)r?  r@  rA  objsrd  r   tblss   ``` r_   rC  z)HDFStore.select_as_multiple.<locals>.funcP  s`            D $TEBBBOOQQQra   rD  )coordinates)rv   rc   rr   rs   rt   rZ   r   r   r   rM  	itertoolschainzipr   is_tablepathnamerE  poprH  rI  )r   r!  ru   selectorr   r   r   r   r   r   rB  rE  r}   rW  _tblsrC  rJ  rd  rh  s   `   `            @@r_   select_as_multiplezHDFStore.select_as_multiple  sx   V U222dT5M** 	s4yyA~~7DdC   
	;;!#%  	 	 	 $u.. 	978884yy 	A?@@@AwH 2111D111OOH%% Oa]OStD5Q5Q5QRR 	Q 	QDAqy5555666: )qz ) ) )  
 }E!! !OPPP "
 :9D999 76666::<<		R 		R 		R 		R 		R 		R 		R !
 
 
 }}}...ra   Tr   r   r   r   r   r   r   r   r   r   track_timesr   c                    |t          d          pd}|                     |          }|                     |||||||||	|
||||           dS )aL  
        Store object in HDFStore.

        This method writes a pandas DataFrame or Series into an HDF5 file using
        either the fixed or table format. The `table` format allows additional
        operations like incremental appends and queries but may have performance
        trade-offs. The `fixed` format provides faster read/write operations but
        does not support appends or queries.

        Parameters
        ----------
        key : str
            Key of object to store in file.
        value : {Series, DataFrame}
            Value of object to store in file.
        format : 'fixed(f)|table(t)', default is 'fixed'
            Format to use when storing object in HDFStore. Value can be one of:

            ``'fixed'``
                Fixed format.  Fast writing/reading. Not-appendable, nor searchable.
            ``'table'``
                Table format.  Write as a PyTables Table structure which may perform
                worse but allow more flexible operations like searching / selecting
                subsets of the data.
        index : bool, default True
            Write DataFrame index as a column.
        append : bool, default False
            This will force Table format, append the input data to the existing.
        complib : default None
            This parameter is currently not accepted.
        complevel : int, 0-9, default None
            Specifies a compression level for data.
            A value of 0 or None disables compression.
        min_itemsize : int, dict, or None
            Dict of columns that specify minimum str sizes.
        nan_rep : str
            Str to use as str nan representation.
        data_columns : list of columns or True, default None
            List of columns to create as data columns, or True to use all columns.
            See `here
            <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#query-via-data-columns>`__.
        encoding : str, default None
            Provide an encoding for strings.
        errors : str, default 'strict'
            The error handling scheme to use for encoding errors.
            The default is 'strict' meaning that encoding errors raise a
            UnicodeEncodeError.  Other possible values are 'ignore', 'replace' and
            'xmlcharrefreplace' as well as any other name registered with
            codecs.register_error that can handle UnicodeEncodeErrors.
        track_times : bool, default True
            Parameter is propagated to 'create_table' method of 'PyTables'.
            If set to False it enables to have the same h5 files (same hashes)
            independent on creation time.
        dropna : bool, default False, optional
            Remove missing values.

        See Also
        --------
        HDFStore.info : Prints detailed information on the store.
        HDFStore.get_storer : Returns the storer object for a key.

        Examples
        --------
        >>> df = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"])
        >>> store = pd.HDFStore("store.h5", "w")  # doctest: +SKIP
        >>> store.put("data", df)  # doctest: +SKIP
        Nio.hdf.default_formatrz   )r   r   r   r   r   r   r   r   rW   r   rs  r   )r   _validate_format_write_to_group)r   r   r   r   r   r   r   r   r   r   r   rW   r   rs  r   s                  r_   r   zHDFStore.putk  s    h > 788CGF&&v..%%# 	 	
 	
 	
 	
 	
ra   c                   t          |d          }	 |                     |          }np# t          $ r  t          $ r  t          $ rO}|t          d          ||                     |          }||                    d           Y d}~dS Y d}~nd}~ww xY wt          j	        |||          r|j
                            d           dS |j        st          d          |                    |||          S )	a:  
        Remove pandas object partially by specifying the where condition

        Parameters
        ----------
        key : str
            Node to remove or delete rows from
        where : list of Term (or convertible) objects, optional
        start : integer (defaults to None), row number to start selection
        stop  : integer (defaults to None), row number to stop selection

        Returns
        -------
        number of rows removed (or None if not a Table)

        Raises
        ------
        raises KeyError if key is not a valid store

        rk   rm   Nz5trying to remove a node with a non-None where clause!T	recursivez7can only remove with where on objects written as tablesrL  )rv   rM  r   AssertionError	Exceptionr   r   	_f_removecomall_noner   rm  delete)r   r   ru   r   r   rB  errr  s           r_   r   zHDFStore.remove  sL   * U222	$$AA 	 	 	 	 	 	 	 	 	   K 
 ==%%D...ttttt  	  <ud++ 	G---4 z 	XVWWWxxe5tx<<<s   ) B?BBbool | list[str]r   c                    |	t          d          |t          d          }|t          d          pd}|                     |          }|                     |||||||||
|||||||           dS )a  
        Append to Table in file.

        Node must already exist and be Table format.

        Parameters
        ----------
        key : str
            Key of object to append.
        value : {Series, DataFrame}
            Value of object to append.
        format : 'table' is the default
            Format to use when storing object in HDFStore.  Value can be one of:

            ``'table'``
                Table format. Write as a PyTables Table structure which may perform
                worse but allow more flexible operations like searching / selecting
                subsets of the data.
        axes : default None
            This parameter is currently not accepted.
        index : bool, default True
            Write DataFrame index as a column.
        append : bool, default True
            Append the input data to the existing.
        complib : default None
            This parameter is currently not accepted.
        complevel : int, 0-9, default None
            Specifies a compression level for data.
            A value of 0 or None disables compression.
        columns : default None
            This parameter is currently not accepted, try data_columns.
        min_itemsize : int, dict, or None
            Dict of columns that specify minimum str sizes.
        nan_rep : str
            Str to use as str nan representation.
        chunksize : int or None
            Size to chunk the writing.
        expectedrows : int
            Expected TOTAL row size of this table.
        dropna : bool, default False, optional
            Do not write an ALL nan row to the store settable
            by the option 'io.hdf.dropna_table'.
        data_columns : list of columns, or True, default None
            List of columns to create as indexed data columns for on-disk
            queries, or True to use all columns. By default only the axes
            of the object are indexed. See `here
            <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#query-via-data-columns>`__.
        encoding : default None
            Provide an encoding for str.
        errors : str, default 'strict'
            The error handling scheme to use for encoding errors.
            The default is 'strict' meaning that encoding errors raise a
            UnicodeEncodeError.  Other possible values are 'ignore', 'replace' and
            'xmlcharrefreplace' as well as any other name registered with
            codecs.register_error that can handle UnicodeEncodeErrors.

        See Also
        --------
        HDFStore.append_to_multiple : Append to multiple tables.

        Notes
        -----
        Does *not* check if data being appended overlaps with existing
        data in the table, so be careful

        Examples
        --------
        >>> df1 = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"])
        >>> store = pd.HDFStore("store.h5", "w")  # doctest: +SKIP
        >>> store.put("data", df1, format="table")  # doctest: +SKIP
        >>> df2 = pd.DataFrame([[5, 6], [7, 8]], columns=["A", "B"])
        >>> store.append("data", df2)  # doctest: +SKIP
        >>> store.close()  # doctest: +SKIP
           A  B
        0  1  2
        1  3  4
        0  5  6
        1  7  8
        Nz>columns is not a supported keyword in append, try data_columnszio.hdf.dropna_tableru  r{   )r   axesr   r   r   r   r   r   r   expectedrowsr   r   rW   r   )r   r   rv  rw  )r   r   r   r   r  r   r   r   r   r   r   r   r   r  r   r   rW   r   s                     r_   r   zHDFStore.append
  s    F P   > 566F> 788CGF&&v..%%%! 	 	
 	
 	
 	
 	
ra   ddictc                   |t          d          t          |t                    st          d          ||vrt          d          t	          t          t          t          j                            t          t          t                                       z
                      }d}	g }
|                                D ]0\  }|	t          d          |}	|
                               1|	ij        |         }|                    t          |
                    }t!          |                    |                    }|                    |          ||	<   |||         }|rVfd|                                D             }t	          |          }|D ]}|                    |          }j        |         |                    dd          }|                                D ]\\  }||k    r|nd}                    |          }| fd	|                                D             nd} | j        ||f||d
| ]dS )a  
        Append to multiple tables

        Parameters
        ----------
        d : a dict of table_name to table_columns, None is acceptable as the
            values of one node (this will get all the remaining columns)
        value : a pandas object
        selector : a string that designates the indexable table; all of its
            columns will be designed as data_columns, unless data_columns is
            passed, in which case these are used
        data_columns : list of columns to create as data columns, or True to
            use all columns
        dropna : if evaluates to True, drop rows from all tables if any single
                 row in each table has all NaN. Default False.

        Notes
        -----
        axes parameter is currently not accepted

        Nztaxes is currently not accepted as a parameter to append_to_multiple; you can create the tables independently insteadzQappend_to_multiple must have a dictionary specified as the way to split the valuez=append_to_multiple requires a selector that is in passed dictz<append_to_multiple can only have one value in d that is Nonec              3  Z   K   | ]%}|                              d           j        V  &dS )all)howN)r   r   )rn   colsr   s     r_   	<genexpr>z.HDFStore.append_to_multiple.<locals>.<genexpr>  s;      OODE$K&&5&117OOOOOOra   r   rd  c                $    i | ]\  }}|v 	||S r   r   )rn   r   r   vs      r_   
<dictcomp>z/HDFStore.append_to_multiple.<locals>.<dictcomp>  s$    QQQeqera   )r   r   )r   rc   r  r   nextr$  setrangendim	_AXES_MAPr   r)  extendr  
differencer/   sortedget_indexertakevaluesintersectionlocro  reindexr   )r   r  r   rp  r   r  r   r   rd  
remain_keyremain_valuesrW  orderedorddidxsvalid_indexr   r   dcvalfilteredr  s     `                  @r_   append_to_multiplezHDFStore.append_to_multiple  s   > B  
 !T"" 	)  
 1O  
 DU5:..//#iU6L2M2MMNNOO 
 GGII 	( 	(DAqy)$V   

$$Q''''!j&G%%eM&:&:;;D'--d3344D#LL..AjM X;L  	+OOOOAHHJJOOODt**K > >)66u==Ik*Ezz.$77 GGII 	R 	RDAq!"hDB -----C  + RQQQ0B0B0D0DQQQQ 
 DK3QRhQQ&QQQQ	R 	Rra   optlevelkindrX   c                    t                       |                     |          }|dS t          |t                    st	          d          |                    |||           dS )a  
        Create a pytables index on the table.

        Parameters
        ----------
        key : str
        columns : None, bool, or listlike[str]
            Indicate which columns to create an index on.

            * False : Do not create any indexes.
            * True : Create indexes on all columns.
            * None : Create indexes on all columns.
            * listlike : Create indexes on the given columns.

        optlevel : int or None, default None
            Optimization level, if None, pytables defaults to 6.
        kind : str or None, default None
            Kind of index, if None, pytables defaults to "medium".

        Raises
        ------
        TypeError: raises if the node is not a table
        Nz1cannot create table index on a Fixed format store)r   r  r  )r   rM  rc   r  r   create_index)r   r   r   r  r  rB  s         r_   create_table_indexzHDFStore.create_table_index  sh    > 				OOC  9F!U## 	QOPPP	wEEEEEra   rr   c                    t                       |                                  | j        J t          J d | j                                        D             S )a  
        Return a list of all the top-level nodes.

        Each node returned is not a pandas storage object.

        Returns
        -------
        list
            List of objects.

        See Also
        --------
        HDFStore.get_node : Returns the node with the key.

        Examples
        --------
        >>> df = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"])
        >>> store = pd.HDFStore("store.h5", "w")  # doctest: +SKIP
        >>> store.put("data", df)  # doctest: +SKIP
        >>> print(store.groups())  # doctest: +SKIP
        >>> store.close()  # doctest: +SKIP
        [/data (Group) ''
          children := ['axis0' (Array), 'axis1' (Array), 'block0_values' (Array),
          'block0_items' (Array)]]
        Nc                    g | ]t}t          |t          j        j                  sSt	          |j        d d          s;t	          |dd          s*t          |t          j        j                  r|j        dk    r|uS )pandas_typeNr{   )	rc   r   linkLinkgetattr_v_attrsr{   r  r   )rn   r(  s     r_   rq   z#HDFStore.groups.<locals>.<listcomp>1  s     
 
 
q*/"677	
 AJt<<
 q'400
 #1j&6&<==
 CD)wBVBV  CWBVBVra   )r   r   r   r   walk_groupsr   s    r_   r   zHDFStore.groups  sh    4 				|'''%%%
 
\--//
 
 
 	
ra   r  ru   *Iterator[tuple[str, list[str], list[str]]]c              #  0  K   t                       |                                  | j        J t          J | j                            |          D ]}t          |j        dd          g }g }|j                                        D ]n}t          |j        dd          }|:t          |t          j
        j                  r|                    |j                   T|                    |j                   o|j                            d          ||fV  dS )a  
        Walk the pytables group hierarchy for pandas objects.

        This generator will yield the group path, subgroups and pandas object
        names for each group.

        Any non-pandas PyTables objects that are not a group will be ignored.

        The `where` group itself is listed first (preorder), then each of its
        child groups (following an alphanumerical order) is also traversed,
        following the same procedure.

        Parameters
        ----------
        where : str, default "/"
            Group where to start walking.

        Yields
        ------
        path : str
            Full path to a group (without trailing '/').
        groups : list
            Names (strings) of the groups contained in `path`.
        leaves : list
            Names (strings) of the pandas objects contained in `path`.

        See Also
        --------
        HDFStore.info : Prints detailed information on the store.

        Examples
        --------
        >>> df1 = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"])
        >>> store = pd.HDFStore("store.h5", "w")  # doctest: +SKIP
        >>> store.put("data", df1, format="table")  # doctest: +SKIP
        >>> df2 = pd.DataFrame([[5, 6], [7, 8]], columns=["A", "B"])
        >>> store.append("data", df2)  # doctest: +SKIP
        >>> store.close()  # doctest: +SKIP
        >>> for group in store.walk():  # doctest: +SKIP
        ...     print(group)  # doctest: +SKIP
        >>> store.close()  # doctest: +SKIP
        Nr  r  )r   r   r   r   r  r  r  _v_childrenr  rc   r   Groupr   r   r   rstrip)r   ru   r(  r   leaveschildr  s          r_   walkzHDFStore.walk>  s(     V 				|'''%%%))%00 	> 	>Aqz=$77CFF--// 1 1%enmTJJ&!%)9)?@@ 5em444MM%-0000='',,ff=====	> 	>ra   Node | Nonec                b   |                                   |                    d          sd|z   }| j        J t          J 	 | j                            | j        |          }n# t          j        j        $ r Y dS w xY wt          |t          j	                  sJ t          |                      |S )z9return the node with the key or None if it does not existr  N)r   
startswithr   r   r   r   
exceptionsNoSuchNodeErrorrc   rM   r   )r   r   r  s      r_   r   zHDFStore.get_node~  s    ~~c"" 	)C|'''%%%	<((C88DD$4 	 	 	44	 $
00<<$t**<<<s    A# #A;:A;GenericFixed | Tablec                    |                      |          }|t          d| d          |                     |          }|                                 |S )z<return the storer object for a key, raise if not in the fileNr7  r8  )r   r   rF  rG  )r   r   r   rB  s       r_   rM  zHDFStore.get_storer  sW    c""=?c???@@@&&	ra   r+  propindexes	overwritec	                6   t          |||||          }	|!t          |                                           }t          |t          t          f          s|g}|D ]}
|                     |
          }||
|	v r|r|	                    |
           |                     |
          }t          |t                    rDd}|rd |j	        D             }|	
                    |
||t          |dd          |j                   |	                    |
||j                   |	S )a;  
        Copy the existing store to a new file, updating in place.

        Parameters
        ----------
        propindexes : bool, default True
            Restore indexes in copied file.
        keys : list, optional
            List of keys to include in the copy (defaults to all).
        overwrite : bool, default True
            Whether to overwrite (remove and replace) existing nodes in the new store.
        mode, complib, complevel, fletcher32 same as in HDFStore.__init__

        Returns
        -------
        open file handle of the new store
        )r   r   r   r   NFc                *    g | ]}|j         	|j        S r   )
is_indexedre   rn   r   s     r_   rq   z!HDFStore.copy.<locals>.<listcomp>  s!     H H HA1< H H H Hra   r   )r   r   rW   r^   )r   rr   r!  rc   rs   rM  r   r   r  r  r   r  rW   r   )r   r   r   r  r!  r   r   r   r  	new_storerW  rB  datar   s                 r_   copyzHDFStore.copy  sO   8 tW	j
 
 
	 <		$$D$.. 	6D 	@ 	@A""A}	>>  ,!((+++{{1~~a'' @.3E" I H H H H H$$#%,Q%E%E!" %     MM!TAJM???ra   c                   t          | j                  }t          |            d| d}| j        r
t	          |                                           }|rg }g }|D ]}	 |                     |          }|M|                    t          |j        p|                     |                    t          |pd                     h# t          $ r  t          $ rG}|                    |           t          |          }	|                    d|	 d           Y d}~d}~ww xY w|t          d||          z  }n|dz  }n|d	z  }|S )
a  
        Print detailed information on the store.

        Returns
        -------
        str
            A String containing the python pandas class name, filepath to the HDF5
            file and all the object keys along with their respective dataframe shapes.

        See Also
        --------
        HDFStore.get_storer : Returns the storer object for a key.

        Examples
        --------
        >>> df1 = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"])
        >>> df2 = pd.DataFrame([[5, 6], [7, 8]], columns=["C", "D"])
        >>> store = pd.HDFStore("store.h5", "w")  # doctest: +SKIP
        >>> store.put("data1", df1)  # doctest: +SKIP
        >>> store.put("data2", df2)  # doctest: +SKIP
        >>> print(store.info())  # doctest: +SKIP
        >>> store.close()  # doctest: +SKIP
        <class 'pandas.io.pytables.HDFStore'>
        File path: store.h5
        /data1            frame        (shape->[2,2])
        /data2            frame        (shape->[2,2])
        r  r  Nzinvalid_HDFStore nodez[invalid_HDFStore node: rY     EmptyzFile is CLOSED)rD   r   r   r   r  r!  rM  r   rn  r{  r|  rC   )
r   r   outputlkeysr!  r  rW  rB  detaildstrs
             r_   infozHDFStore.info  s   8 DJ''JJ55T555< 	'499;;''E " J JAJ OOA..= KKQZ_1(E(EFFF"MM,q7S<S*T*TUUU)   $ J J JA+F33&H&H&H&HIIIIIIIIJ
 &T6222'!&&Fs   A$CD=DDc                B    | j         st          | j         d          d S )Nz file is not open!)r   r   r   r   s    r_   r   zHDFStore._check_if_open  s2    | 	E!TZ"C"C"CDDD	E 	Era   r   c                    	 t           |                                         }n&# t          $ r}t          d| d          |d}~ww xY w|S )zvalidate / deprecate formatsz#invalid HDFStore format specified [rY  N)_FORMAT_MAPlowerr   r   )r   r   r  s      r_   rv  zHDFStore._validate_format  sc    	V 0FF 	V 	V 	VK&KKKLLRUU	V s   " 
AA  ArV   DataFrame | Series | NonerW   c           	     N   |+t          |t          t          f          st          d          t	          |j        dd          }t	          |j        dd          }||[t                       t          J t	          |dd          st          |t          j        j	                  rd}d}n4t          d          t          |t                    rd	}nd
}|dk    r|dz  }d|vr`t          t          d}	 ||         }	n8# t          $ r+}
t          d| dt          |           d|           |
d}
~
ww xY w |	| |||          S |k|i|dk    r/t	          |dd          }||j        dk    rd}nB|j        dk    rd}n4|dk    r.t	          |dd          }||j        dk    rd}n|j        dk    rd}t          t           t"          t$          t&          t(          d}	 ||         }	n8# t          $ r+}
t          d| dt          |           d|           |
d}
~
ww xY w |	| |||          S )z"return a suitable class to operateNz(value must be None, Series, or DataFramer  
table_typer{   frame_tablegeneric_tablezKcannot create a storer if the object is not existing nor a value are passedseriesframe_table)r  r  z=cannot properly create the storer for: [_STORER_MAP] [group->,value->z	,format->rW   r   series_tabler   rk   appendable_seriesappendable_multiseriesappendable_frameappendable_multiframe)r  r  r  r  r  wormz<cannot properly create the storer for: [_TABLE_MAP] [group->)rc   r3   r-   r   r  r  r   r   r{   r  SeriesFixed
FrameFixedr   r   nlevelsGenericTableAppendableSeriesTableAppendableMultiSeriesTableAppendableFrameTableAppendableMultiFrameTable	WORMTable)r   r   r   r   rW   r   pttt_STORER_MAPclsr  r   
_TABLE_MAPs                r_   rF  zHDFStore._create_storer  s    Z	7J%K%KFGGGU^]D99U^\488 :}			!---5'400 	J:+15 5 	 'B(BB#1  
 eV,, !!BB B W$$(NB "%0:FFK!"o   EE E&*5kkE E<BE E  
 3tUXfEEEE : ''#E7D99E( =A--!4BB"]Q..!9B=((#E7D99E( =A--!3BB"]Q..!8B *!6&@ 4%>
 

	R.CC 	 	 	AA A"&u++A A8>A A  	 s4&AAAAs0   2C; ;
D0&D++D0G   
H*&HHc                *   t          |dd           r
|dk    s|rd S |                     ||          }|                     |||||          }|rF|j        r|j        r|dk    r|j        rt          d          |j        s|                                 n|                                 |j        s|rt          d          |                    ||||||	|
||||||           t          |t                    r|r|
                    |           d S d S d S )	Nemptyr{   r  rz   zCan only append to Tablesz0Compression not supported on Fixed format stores)objr  r   r   r   r   r   r   r  r   r   r   rs  r   )r  _identify_grouprF  rm  	is_existsr   set_object_infowriterc   r  r  )r   r   r   r   r  r   r   r   r   r   r   r   r  r   r   r   rW   r   rs  r   rB  s                        r_   rw  zHDFStore._write_to_groupz  s{   . 5'4(( 	f.?.?6.?F$$S&11vuxPVWW 	  : >!* >71B1Bq{1B !<===; $!!###z 	Qg 	QOPPP 	
!%%%# 	 	
 	
 	
  a 	*E 	*NN5N)))))	* 	* 	* 	*ra   r   rM   c                |    |                      |          }|                                 |                                S r\   )rF  rG  r>  )r   r   rB  s      r_   r9  zHDFStore._read_group  s/    &&	vvxxra   c                    |                      |          }| j        J | |s| j                            |d           d}||                     |          }|S )z@Identify HDF5 group based on key, delete/create group if needed.NTry  )r   r   remove_node_create_nodes_and_group)r   r   r   r   s       r_   r  zHDFStore._identify_group  sm    c"" |''' VL$$Ud$;;;E=0055Era   c                   | j         J |                    d          }d}|D ]g}t          |          s|}|                    d          s|dz  }||z  }|                     |          }|| j                             ||          }|}h|S )z,Create nodes from key and return group name.Nr  )r   splitrt   endswithr   create_group)r   r   pathsr   pnew_pathr   s          r_   r  z HDFStore._create_nodes_and_group  s     |'''		# 
	 
	Aq66 H==%%  CMHMM(++E}11$::DDra   )r   NNF)r   rZ   r   r   r   r   rY   r   rY   rZ   r   rZ   )r   rZ   rY   r   )r   rZ   rY   r   )re   rZ   )r   rZ   rY   r   rY   ri   )rY   r   )r  r  r  r  r  r  rY   r   )r   )r  rZ   rY   r  )rY   r"  )rY   r&  )r   )r   rZ   rY   r   rY   r   rY   r   F)r2  r   rY   r   )NNNNFNF)r   rZ   r   r   r   r   r   r   NNNr   rZ   r   r   r   r   NN)r   rZ   rQ  rZ   r   r   r   r   )NNNNNFNF)r   r   r   r   r   r   )NTFNNNNNNr   TF)r   rZ   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   rs  r   r   r   rY   r   )NNTTNNNNNNNNNNr   )r   rZ   r   r   r   r  r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   rY   r   )NNF)r  r  r   r   rY   r   )r   rZ   r  r   r  rX   rY   r   rY   rr   )r  )ru   rZ   rY   r  )r   rZ   rY   r  )r   rZ   rY   r  )r+  TNNNFT)r   rZ   r  r   r   r   r   r   r  r   rY   r   )r   rZ   rY   rZ   )NNrV   r   )r   r  rW   rZ   r   rZ   rY   r  )NTFNNNNNNFNNNr   T)r   rZ   r   r   r   r  r   r   r   r   r   r   r   r   r   r   r   rZ   rs  r   rY   r   )r   rM   )r   rZ   r   r   rY   rM   )r   rZ   rY   rM   )1r   
__module____qualname____doc____annotations__r   r   propertyr   r   r   r   r   r   r  r  r	  r  r  r!  r%  r)  r   r   r   r4  r   r   rP  rT  rr  r   r   r   r  r  r   r  r   rM  r  r  r   rv  rF  rw  r9  r  r  r   ra   r_   r   r     sl        ? ?B JJJ
  $ ' ' ' ' 'B    ! ! X!    X             
 
 
 

 
 
 
" " " "4 4 4 4      .
 .
 .
 .
 .
`! ! ! !# # # #+J +J +J +J +JZ    ) ) ) X)4 4 4 4 4,!+ !+ !+ !+L  $ a a a a aL  I I I I IH !&F &F &F &F &FV  $ w/ w/ w/ w/ w/z  $489= f
 f
 f
 f
 f
P5= 5= 5= 5= 5=v "& $48 $"9=%~
 ~
 ~
 ~
 ~
J _R _R _R _R _RH #&F &F &F &F &FP)
 )
 )
 )
V>> >> >> >> >>@          $ 9 9 9 9 9v9 9 9 9|E E E E    +/YB YB YB YB YB@ "& $48 $ '<* <* <* <* <*|   
   $     ra   r   c                  `    e Zd ZU dZded<   ded<   ded<   	 	 	 	 	 dddZddZddZdddZdS )rH  aa  
    Define the iteration interface on a table

    Parameters
    ----------
    store : HDFStore
    s     : the referred storer
    func  : the function to execute the query
    where : the where of the query
    nrows : the rows to iterate on
    start : the passed start value (default is None)
    stop  : the passed stop value (default is None)
    iterator : bool, default False
        Whether to use the default iterator.
    chunksize : the passed chunking value (default is 100000)
    auto_close : bool, default False
        Whether to automatically close the store at the end of iteration.
    r   r   r   r   r  rB  NFr   r   r   rY   r   c                   || _         || _        || _        || _        | j        j        r|d}|d}||}t          ||          }|| _        || _        || _        d | _	        |s|	|	d}	t          |	          | _        nd | _        |
| _        d S )Nr   順 )r   rB  rC  ru   rm  minrE  r   r   ri  ri   r   r   )r   r   rB  rC  ru   rE  r   r   r   r   r   s              r_   r   zTableIterator.__init__  s     
	
 6? 	$}}|ud##D

	 	"y, "	 ^^DNN!DN$ra   rG   c              #  J  K   | j         }| j        t          d          || j        k     rdt	          || j        z   | j                  }|                     d d | j        ||                   }|}|t          |          s`|V  || j        k     d|                                  d S )Nz*Cannot iterate until get_result is called.)	r   ri  r   r   r  r   rC  rt   r   )r   r   r   r   s       r_   r%  zTableIterator.__iter__'  s      *#IJJJ	!!w/;;DIIdD$*:74<*HIIEG}CJJ}KKK 	!! 	

ra   c                J    | j         r| j                                         d S d S r\   )r   r   r   r   s    r_   r   zTableIterator.close7  s0    ? 	J	 	ra   ri  c                   | j         Pt          | j        t                    st	          d          | j                            | j                  | _        | S |rVt          | j        t                    st	          d          | j                            | j        | j        | j	                  }n| j        }| 
                    | j        | j	        |          }|                                  |S )Nz0can only use an iterator or chunksize on a table)ru   z$can only read_coordinates on a tablerL  )r   rc   rB  r  r   rN  ru   ri  r   r   rC  r   )r   ri  ru   resultss       r_   rI  zTableIterator.get_result;  s    >%dfe,, T RSSS#v66TZ6HHDK  	dfe,, H FGGGF++j
 ,  EE JE ))DJ	599

ra   )NNFNF)r   r   rB  r  r   r   r   r   r   r   rY   r   rY   rG   r  r  )ri  r   )	r   r  r  r  r  r   r%  r   rI  r   ra   r_   rH  rH    s          & OOO  $ (% (% (% (% (%T             ra   rH  c                     e Zd ZU dZdZded<   dZded<   g dZ	 	 	 	 	 	 	 	 	 	 	 	 	 d4d5dZe	d6d            Z
e	d7d            Zd8dZd7dZd9dZd:dZe	d:d            Zd;dZd  Ze	d!             Ze	d"             Ze	d#             Ze	d$             Zd<d&Zd=d>d'Zd>d(Zd?d,Zd=d-Zd@d.Zd>d/Zd>d0Zd>d1ZdAd2Z dAd3Z!dS )BIndexCola  
    an index column description class

    Parameters
    ----------
    axis   : axis which I reference
    values : the ndarray like converted values
    kind   : a string description of this type
    typ    : the pytables type
    pos    : the position in the pytables

    Tr   is_an_indexableis_data_indexable)freqtz
index_nameNre   rZ   cnamerX   rY   r   c                   t          |t                    st          d          || _        || _        || _        || _        |p|| _        || _        || _	        || _
        |	| _        |
| _        || _        || _        || _        || _        ||                     |           t          | j        t                    sJ t          | j        t                    sJ d S )Nz`name` must be a str.)rc   rZ   r   r  r  typre   r+  rd  posr(  r)  r*  r  r{   r   metadataset_pos)r   re   r  r  r-  r+  rd  r.  r(  r)  r*  r  r{   r   r/  s                  r_   r   zIndexCol.__init__g  s    " $$$ 	64555		]d
		$
	 ?LL $)S)))))$*c*******ra   ri   c                    | j         j        S r\   )r-  itemsizer   s    r_   r2  zIndexCol.itemsize  s     x  ra   c                    | j          dS )N_kindrd   r   s    r_   	kind_attrzIndexCol.kind_attr      )""""ra   r.  c                F    || _         || j        || j        _        dS dS dS )z,set the position of this column in the TableN)r.  r-  _v_pos)r   r.  s     r_   r0  zIndexCol.set_pos  s/    ?tx3!DHOOO ?33ra   c           
         t          t          t          | j        | j        | j        | j        | j        f                    }d                    d t          g d|d          D                       S )N,c                "    g | ]\  }}| d | S z->r   rn   r   r   s      r_   rq   z%IndexCol.__repr__.<locals>.<listcomp>  :       C !!%!!  ra   )re   r+  rd  r.  r  TrX  )
rs   maprD   re   r+  rd  r.  r  joinrl  r   temps     r_   r	  zIndexCol.__repr__  s    ty$*di49UVV
 
 xx "%<<<d4# # #  
 
 	
ra   otherobjectc                >     t           fddD                       S )compare 2 col itemsc              3  `   K   | ](}t          |d           t          |d           k    V  )d S r\   r  rn   r   rC  r   s     r_   r  z"IndexCol.__eq__.<locals>.<genexpr>  T       
 
 D!T""geQ&=&==
 
 
 
 
 
ra   )re   r+  rd  r.  r  r   rC  s   ``r_   __eq__zIndexCol.__eq__  sA     
 
 
 
 
5
 
 
 
 
 	
ra   c                .    |                      |           S r\   )rM  rL  s     r_   __ne__zIndexCol.__ne__  s    ;;u%%%%ra   c                x    t          | j        d          sdS t          | j        j        | j                  j        S )z%return whether I am an indexed columnr  F)hasattrr{   r  r  r+  r  r   s    r_   r  zIndexCol.is_indexed  s6     tz6** 	5tz
33>>ra   r  
np.ndarrayrW   r   3tuple[np.ndarray, np.ndarray] | tuple[Index, Index]c           	        t          |t          j                  sJ t          |                      |j        j        || j                                                 }| j        }t          ||||          }i }| j
        |d<   | j        
| j        |d<   t          }t          j        |j        d          st          |j        t                    rt           }n|j        dk    rd|v rd }	  ||fi |}n# t"          $ rm}	|dk    r\t%                      rNt'          |	                              d          r,t*          r% ||fd	t-          d
t          j                  i|}n Y d}	~	n%d}	~	wt0          $ r d|v rd|d<    ||fi |}Y nw xY w| j        Ct          |t                     r.|                    d                              | j                  }
n|}
|
|
fS )zV
        Convert the data from this selection to the appropriate pandas type.
        Nre   r(  Mi8c                    t          j        | |                    dd                                         |d                   S )Nr(  )r(  re   )r1   from_ordinalsr   _rename)r\  kwdss     r_   r   z"IndexCol.convert.<locals>.<lambda>  s?    (A..) ) )gd6l## ra   surrogatepasssurrogates not alloweddtypepythonstoragena_valueUTC)rc   npndarrayr   r]  fieldsr+  r  r  _maybe_convertr*  r(  r/   r   is_np_dtyper)   r.   UnicodeEncodeErrorr   rZ   r  r   r4   nanr   r)  tz_localize
tz_convert)r   r  r   rW   r   val_kindr   factorynew_pd_indexr  final_pd_indexs              r_   convertzIndexCol.convert  sM    &"*--;;tF||;;; <* DJ',,..F9(FCCv9 !YF6N/4?6<-- 	$L/2
 2
 	$ $GG\T!!f&6&6
$ $G
	5"7644V44LL! 	 	 	/))&(( *HH%%&>?? *   *
  'w   %hHHH         	5 	5 	5 !%v"7644V44LLL	5 7:lM#J#J)55e<<GGPPNN)N~--s   )	C3 3
F=A#E%%FFc                    | j         S )zreturn the valuesr  r   s    r_   	take_datazIndexCol.take_data	  s
    {ra   c                    | j         j        S r\   )r{   r  r   s    r_   attrszIndexCol.attrs	      z""ra   c                    | j         j        S r\   r{   descriptionr   s    r_   ry  zIndexCol.description	      z%%ra   c                8    t          | j        | j        d          S )z!return my current col descriptionN)r  ry  r+  r   s    r_   colzIndexCol.col	  s     t'T:::ra   c                    | j         S zreturn my cython valuesrr  r   s    r_   cvalueszIndexCol.cvalues	  s     {ra   rG   c                *    t          | j                  S r\   )r$  r  r   s    r_   r%  zIndexCol.__iter__	  s    DK   ra   c                   | j         dk    rpt          |t                    r|                    | j                  }|A| j        j        |k     r3t                                          || j	                  | _        dS dS dS dS )z
        maybe set a string col itemsize:
            min_itemsize can be an integer or a dict with this columns name
            with an integer size
        stringN)r2  r.  )
r  rc   r  r   re   r-  r2  r   	StringColr.  )r   r   s     r_   maybe_set_sizezIndexCol.maybe_set_size	  s     9  ,-- ;+//	::'DH,=,L,L"99..$(.SS !  (',L,Lra   c                    d S r\   r   r   s    r_   validate_nameszIndexCol.validate_names)	      ra   handlerAppendableTabler   c                    |j         | _         |                                  |                     |           |                     |           |                     |           |                                  d S r\   )r{   validate_colvalidate_attrvalidate_metadatawrite_metadataset_attr)r   r  r   s      r_   validate_and_setzIndexCol.validate_and_set,	  sj    ]
6"""w'''G$$$ra   c           	         | j         dk    rG| j        }|>|| j        }|j        |k     r#t          d| d| j         d|j         d          |j        S dS )z:validate this column: return the compared against itemsizer  Nz#Trying to store a string with len [z] in [z)] column but
this column has a limit of [zC]!
Consider using min_itemsize to preset the sizes on these columns)r  r|  r2  r   r+  )r   r2  cs      r_   r  zIndexCol.validate_col4	  s     9  A}##}H:(($<h < < J< <J< < <   z!tra   c                    |rCt          | j        | j        d           }|(|| j        k    rt	          d| d| j         d          d S d S d S )Nzincompatible kind in col [ - rY  )r  ru  r5  r  r   )r   r   existing_kinds      r_   r  zIndexCol.validate_attrG	  sq     	#DJEEM(]di-G-GOOO49OOO  	 	((-G-Gra   c                   | j         D ]}t          | |d          }|                    | j        i           }|                    |          }||v ry|w||k    rq|dv rLt
          |||fz  }t          j        |t          t                                 d||<   t          | |d           t          d| j         d| d| d| d	          |||||<   dS )	z
        set/update the info for this indexable with the key/value
        if there is a conflict raise/warn as needed
        N)r(  r*  
stacklevelzinvalid info for [z] for [z], existing_value [z] conflicts with new value [rY  )_info_fieldsr  
setdefaultre   r   rx   warningswarnr   r!   setattrr   )r   r  r   r   idxexisting_valuewss          r_   update_infozIndexCol.update_infoP	  s;   
 $ 	! 	!CD#t,,E//$)R00C WWS\\Nczze/Ne4K4K000/32NNBM4AQASAS   
  $CHD#t,,,, %/TY / /s / /+9/ /&+/ / /  
 "n&@ C1	! 	!ra   c                v    |                     | j                  }|| j                            |           dS dS )z!set my state from the passed infoN)r   re   __dict__update)r   r  r  s      r_   set_infozIndexCol.set_infoo	  s=    hhty!!?M  %%%%% ?ra   c                F    t          | j        | j        | j                   dS )zset the kind for this columnN)r  ru  r5  r  r   s    r_   r  zIndexCol.set_attru	  s     
DNDI66666ra   c                    | j         dk    rG| j        }|                    | j                  }|&|&t	          ||dd          st          d          dS dS dS dS )z:validate that kind=category does not change the categoriescategoryNT
strict_nandtype_equalzEcannot append a categorical with different categories to the existing)r   r/  read_metadatar+  r,   r   )r   r  new_metadatacur_metadatas       r_   r  zIndexCol.validate_metadatay	  s    9
""=L"00<<L( ,( ,4T   -
 !;   #" )(,,,,ra   c                X    | j         "|                    | j        | j                    dS dS )zset the meta dataN)r/  r  r+  )r   r  s     r_   r  zIndexCol.write_metadata	  s2    =$""4:t}===== %$ra   )NNNNNNNNNNNNN)re   rZ   r+  rX   rY   r   r  r  )r.  ri   rY   r   rC  rD  rY   r   r  )r  rR  rW   rZ   r   rZ   rY   rS  r#  r\   r  )r  r  r   r   rY   r   )r   r   rY   r   )r  r  rY   r   )"r   r  r  r  r&  r  r'  r  r   r  r2  r5  r0  r	  rM  rO  r  rp  rs  ru  ry  r|  r  r%  r  r  r  r  r  r  r  r  r  r  r   ra   r_   r%  r%  U  s          !O    """""///L
  )+ )+ )+ )+ )+V ! ! ! X! # # # X#" " " "
 
 
 

 
 
 
& & & & ? ? ? X?A. A. A. A.F   # # X# & & X& ; ; X;   X! ! ! !T T T T T         &   ! ! ! !>& & & &7 7 7 7   "> > > > > >ra   r%  c                  :    e Zd ZdZedd            ZddZddZdS )GenericIndexColz:an index which is not represented in the data of the tablerY   r   c                    dS NFr   r   s    r_   r  zGenericIndexCol.is_indexed	      ura   r  rR  rW   rZ   r   tuple[Index, Index]c                    t          |t          j                  sJ t          |                      t	          t          |                    }||fS )z
        Convert the data from this selection to the appropriate pandas type.

        Parameters
        ----------
        values : np.ndarray
        nan_rep : str
        encoding : str
        errors : str
        )rc   rc  rd  r   r2   rt   )r   r  r   rW   r   r   s         r_   rp  zGenericIndexCol.convert	  sG     &"*--;;tF||;;;3v;;''e|ra   r   c                    d S r\   r   r   s    r_   r  zGenericIndexCol.set_attr	  r  ra   Nr  )r  rR  rW   rZ   r   rZ   rY   r  r  )r   r  r  r  r  r  rp  r  r   ra   r_   r  r  	  s`        DD   X   $     ra   r  c                  j    e Zd ZdZdZdZddgZ	 	 	 	 	 	 	 	 	 	 	 	 d,d- fdZed.d            Z	ed.d            Z
d.dZd/dZd0dZd Zed1d            Zed             Zed2d             Zed3d!            Zed"             Zed#             Zed$             Zed%             Zd4d&Zd5d*Zd4d+Z xZS )6DataCola3  
    a data holding column, by definition this is not indexable

    Parameters
    ----------
    data   : the actual data
    cname  : the column name in the table to hold the data (typically
                values)
    meta   : a string description of the metadata
    metadata : the actual metadata
    Fr)  r  Nre   rZ   r+  rX   r]  DtypeArg | NonerY   r   c                |    t                                          |||||||||	|
|           || _        || _        d S )N)re   r  r  r-  r.  r+  r)  r  r{   r   r/  )superr   r]  r  )r   re   r  r  r-  r+  r.  r)  r  r{   r   r/  r]  r  	__class__s                 r_   r   zDataCol.__init__	  s[      	 	 	
 	
 	
 
			ra   c                    | j          dS )N_dtyperd   r   s    r_   
dtype_attrzDataCol.dtype_attr	  s    )####ra   c                    | j          dS )N_metard   r   s    r_   	meta_attrzDataCol.meta_attr	  r6  ra   c           
         t          t          t          | j        | j        | j        | j        | j        f                    }d                    d t          g d|d          D                       S )Nr:  c                "    g | ]\  }}| d | S r<  r   r=  s      r_   rq   z$DataCol.__repr__.<locals>.<listcomp>	  r>  ra   )re   r+  r]  r  shapeTrX  )
rs   r?  rD   re   r+  r]  r  r  r@  rl  rA  s     r_   r	  zDataCol.__repr__	  s    ty$*dj$)TZX 
 

 xx "%???d# # #  
 
 	
ra   rC  rD  r   c                >     t           fddD                       S )rF  c              3  `   K   | ](}t          |d           t          |d           k    V  )d S r\   rH  rI  s     r_   r  z!DataCol.__eq__.<locals>.<genexpr>	  rJ  ra   )re   r+  r]  r.  rK  rL  s   ``r_   rM  zDataCol.__eq__	  sA     
 
 
 
 
6
 
 
 
 
 	
ra   r  rO   c                    |J | j         J t          |          \  }}|| _        || _         t          |          | _        d S r\   )r]  _get_data_and_dtype_namer  _dtype_to_kindr  )r   r  
dtype_names      r_   set_datazDataCol.set_data	  sO    z!!!3D99j	
":..			ra   c                    | j         S )zreturn the datar  r   s    r_   rs  zDataCol.take_data
  s
    yra   r  rK   c                   |j         }|j        }|j        }|j        dk    r	d|j        f}t          |t                    r)|j        }|                     ||j         j	                  }nt          j        |d          st          |t                    r|                     |          }nt          j        |d          r|                     |          }n{t          |          r*t!                                          ||d                   }nBt%          |          r|                     ||          }n|                     ||j	                  }|S )zW
        Get an appropriately typed and shaped pytables.Col object for values.
        rk   r  rU  mr   r2  r  )r]  r2  r  r  sizerc   r8   codesget_atom_datare   r   rg  r)   get_atom_datetime64get_atom_timedelta64r$   r   
ComplexColr&   get_atom_string)r  r  r]  r2  r  r  atoms          r_   	_get_atomzDataCol._get_atom

  sI   
  >;! $Efk** 	=LE$$U1A$BBDD_UC(( 		=Juo,N,N 		=**511DD_UC(( 	=++E22DDe$$ 	=99''q'JJDDU## 	=&&uh77DD$$U$<<Dra   c                T    t                                          ||d                   S )Nr   r  r   r  r  r  r2  s      r_   r  zDataCol.get_atom_string*
  s#    yy""HE!H"EEEra   r  	type[Col]c                    |                     d          r|dd         }d| d}n1|                     d          rd}n|                                }| d}t          t                      |          S )z0return the PyTables column class for this columnuint   NUIntrK   periodInt64Col)r  
capitalizer  r   )r  r  k4col_namekcaps        r_   get_atom_coltypezDataCol.get_atom_coltype.
  s}     ??6"" 	$abbB%b~~~HH__X&& 	$!HH??$$D|||Hwyy(+++ra   c                N     |                      |          |d                   S )Nr  r   r  r  r  r  r  s      r_   r  zDataCol.get_atom_data=
  s*    .s###..U1X>>>>ra   c                R    t                                          |d                   S Nr   r  r   r  r  r  s     r_   r  zDataCol.get_atom_datetime64A
  !    yy!!a!111ra   c                R    t                                          |d                   S r  r  r  s     r_   r  zDataCol.get_atom_timedelta64E
  r  ra   c                .    t          | j        dd           S )Nr  )r  r  r   s    r_   r  zDataCol.shapeI
  s    ty'4000ra   c                    | j         S r~  r  r   s    r_   r  zDataCol.cvaluesM
  s     yra   c                   |r{t          | j        | j        d          }|'|t          | j                  k    rt          d          t          | j        | j        d          }||| j        k    rt          d          dS dS dS )zAvalidate that we have the same order as the existing & same dtypeNz4appended items do not match existing items in table!z@appended items dtype do not match existing items dtype in table!)r  ru  r5  rr   r  r   r  r]  )r   r   existing_fieldsexisting_dtypes       r_   r  zDataCol.validate_attrR
  s     		%dj$.$GGO*$t{BSBS/S/S !WXXX$TZ$GGN)n
.J.J V  		 		 *).J.Jra   rR  rW   r   c                   t          |t          j                  sJ t          |                      |j        j        || j                 }| j        J | j        "t          |          \  }}t          |          }n|}| j        }| j
        }t          |t          j                  sJ | j        }| j        }	| j        }
| j        }|J |}|                    d          rt!          |||          }n|                    d          r6|dk    rt          j        |d          }n~t          j        ||          }nf|dk    r^	 t          j        d |D             t$                    }n8# t&          $ r) t          j        d |D             t$                    }Y nw xY w|d	k    r|	}|                                }|t+          g t          j                  }not/          |          }|                                rL||          }||d
k    xx         |                    t4                                                    j        z  cc<   t;          j        |||
d          }n@	 |                    |d          }n'# t>          $ r |                    dd          }Y nw xY w|dk    rtA          ||||          }| j!        |fS )aR  
        Convert the data from this selection to the appropriate pandas type.

        Parameters
        ----------
        values : np.ndarray
        nan_rep :
        encoding : str
        errors : str

        Returns
        -------
        index : listlike to become an Index
        data : ndarraylike to become a column
        N
datetime64timedelta64m8[ns]r]  r   c                6    g | ]}t          j        |          S r   r   fromordinalrn   r  s     r_   rq   z#DataCol.convert.<locals>.<listcomp>
  s#    <<<QT%a((<<<ra   c                6    g | ]}t          j        |          S r   r   fromtimestampr  s     r_   rq   z#DataCol.convert.<locals>.<listcomp>
  s#    >>>qT'**>>>ra   r  F)
categoriesr  validater  Or  r   rW   r   )"rc   rc  rd  r   r]  re  r+  r-  r  r  r  r   r/  r  r)  r  _set_tzasarrayrD  r   ravelr/   float64r7   anyastyperi   cumsum_valuesr8   
from_codesr   _unconvert_string_arrayr  )r   r  r   rW   r   	convertedr  r  r   r/  r  r)  r]  r	  r  masks                   r_   rp  zDataCol.convert_
  s(     &"*--;;tF||;;; <*DJ'Fx###: %=V$D$D!Iz!*--DDIJ9D)RZ00000 y=,W%%% L)) 0	>	2u55IIm,, ,	>%%JyAAA		Jy>>>		f__J<<)<<<F  		    J>>I>>>f  			
 Z!JOO%%E
 !
 #2RZ888

J''88:: L!+TE!2J%2+&&&$++c*:*:*A*A*C*C*KK&&&#.*g  II
>%,,U,??		 > > >%,,Su,==			> 8/7Xf  I {I%%s$   %E, ,/FF%I= =!J! J!c                    t          | j        | j        | j                   t          | j        | j        | j                   | j        J t          | j        | j        | j                   dS )zset the data for this columnN)r  ru  r5  r  r  r   r]  r  r   s    r_   r  zDataCol.set_attr
  s^    
DNDK888
DNDI666z%%%
DOTZ88888ra   )NNNNNNNNNNNN)re   rZ   r+  rX   r]  r  rY   r   r  r  )r  rO   rY   r   )r  rO   rY   rK   )r  rZ   rY   r  r  rZ   rY   rK   r  )r  rR  rW   rZ   r   rZ   )r   r  r  r  r&  r'  r  r   r  r  r  r	  rM  r  rs  classmethodr  r  r  r  r  r  r  r  r  rp  r  __classcell__r  s   @r_   r  r  	  s@       
 
 O)$L
  !%      @ $ $ $ X$ # # # X#
 
 
 

 
 
 
/ / / /      [> F F [F , , , [, ? ? ? [? 2 2 [2 2 2 [2 1 1 X1   X   f& f& f& f&P9 9 9 9 9 9 9 9ra   r  c                  x    e Zd ZdZdZddZed             Zedd
            Zed             Z	ed             Z
dS )DataIndexableColz+represent a data column that can be indexedTrY   r   c                p    t          t          | j                  j                  st	          d          d S )N-cannot have non-object label DataIndexableCol)r&   r/   r  r]  r   r   s    r_   r  zDataIndexableCol.validate_names
  s;    uT[11788 	NLMMM	N 	Nra   c                F    t                                          |          S )N)r2  r  r  s      r_   r  z DataIndexableCol.get_atom_string
  s    yy""H"555ra   r  rZ   rK   c                >     |                      |                      S )Nr  r  r  s      r_   r  zDataIndexableCol.get_atom_data
  s!    .s###..000ra   c                B    t                                                      S r\   r  r  s     r_   r  z$DataIndexableCol.get_atom_datetime64
      yy!!###ra   c                B    t                                                      S r\   r  r  s     r_   r  z%DataIndexableCol.get_atom_timedelta64
  r&  ra   Nr  r  )r   r  r  r  r'  r  r  r  r  r  r  r   ra   r_   r   r   
  s        55N N N N
 6 6 [6 1 1 1 [1 $ $ [$ $ $ [$ $ $ra   r   c                      e Zd ZdZdS )GenericDataIndexableColz(represent a generic pytables data columnN)r   r  r  r  r   ra   r_   r)  r)  
  s        2222ra   r)  c                     e Zd ZU dZded<   dZded<   ded<   ded	<   d
ed<   dZded<   	 	 d8d9dZed:d            Z	ed;d            Z
ed             Zd<dZd=dZd>dZed              Zed!             Zed"             Zed#             Zed?d$            Zed:d%            Zed&             Zd=d'Zd=d(Zed)             Zed:d*            Zed+             Zd@d-ZdAd=d/Zd:d0Z	 	 	 	 dBdCd5Zd=d6Z	 dDdEd7Z d.S )FFixedz
    represent an object in my store
    facilitate read/write of various types of objects
    this is an abstract base class

    Parameters
    ----------
    parent : HDFStore
    group : Node
        The group node where the table resides.
    rZ   pandas_kindrz   format_typetype[DataFrame | Series]obj_typeri   r  r   r   Fr   rm  rV   r   r   rM   rW   rX   r   rY   r   c                $   t          |t                    sJ t          |                      t          J t          |t          j                  sJ t          |                      || _        || _        t          |          | _        || _	        d S r\   )
rc   r   r   r   rM   r   r   r`   rW   r   )r   r   r   rW   r   s        r_   r   zFixed.__init__  s     &(++99T&\\999%%%%11>>4;;>>>
(22ra   c                h    | j         d         dk    o!| j         d         dk    o| j         d         dk     S )Nr   rk   
      )versionr   s    r_   is_old_versionzFixed.is_old_version  s4    |A!#UQ2(=U$,q/TUBUUra   tuple[int, int, int]c                    t          | j        j        dd          }t          |t                    r]t          d |                    d          D                       }t          |          dk    rg |dR }t          |          dk    sJ |S dS )	zcompute and set our versionpandas_versionNc              3  4   K   | ]}t          |          V  d S r\   ri   r[  s     r_   r  z Fixed.version.<locals>.<genexpr>  s(      CC1ACCCCCCra   .r3  r      )r   r   r   )r  r   r  rc   rZ   rs   r  rt   )r   r4  version_tups      r_   r4  zFixed.version  s     $*-/?FFgs## 	CCc0B0BCCCCCK;1$$//Q//{##q((((9ra   c                8    t          | j        j        dd           S )Nr  )r  r   r  r   s    r_   r  zFixed.pandas_type"  s    tz*M4@@@ra   c                    |                                   | j        }|Ot          |t          t          f          r%d                    d |D                       }d| d}| j        dd| dS | j        S )	(return a pretty representation of myselfNr:  c                ,    g | ]}t          |          S r   rD   r[  s     r_   rq   z"Fixed.__repr__.<locals>.<listcomp>,  s    ">">">q<??">">">ra   [rY  12.12z	 (shape->))rG  r  rc   rr   rs   r@  r  )r   rB  jshapes      r_   r	  zFixed.__repr__&  s    J=!dE]++ "">">A">">">??!MMM&;;;q;;;;ra   c                ~    t          | j                  | j        _        t          t                    | j        _        dS )zset my pandas type & versionN)rZ   r,  ru  r  _versionr8  r   s    r_   r  zFixed.set_object_info1  s-    !$T%5!6!6
$'MM
!!!ra   c                .    t          j         |           }|S r\   r  )r   new_selfs     r_   r  z
Fixed.copy6  s    9T??ra   c                    | j         S r\   )rE  r   s    r_   r  zFixed.shape:  r   ra   c                    | j         j        S r\   r   r   r   s    r_   rn  zFixed.pathname>  rz  ra   c                    | j         j        S r\   )r   r   r   s    r_   r   zFixed._handleB  s    {""ra   c                    | j         j        S r\   )r   r   r   s    r_   r   zFixed._filtersF  s    {##ra   c                    | j         j        S r\   )r   r   r   s    r_   r   zFixed._complevelJ  s    {%%ra   c                    | j         j        S r\   )r   r   r   s    r_   r   zFixed._fletcher32N  s    {&&ra   c                    | j         j        S r\   )r   r  r   s    r_   ru  zFixed.attrsR  rv  ra   c                    dS zset our object attributesNr   r   s    r_   	set_attrszFixed.set_attrsV        ra   c                    dS )zget our object attributesNr   r   s    r_   	get_attrszFixed.get_attrsY  rV  ra   c                    | j         S )zreturn my storabler   r   s    r_   storablezFixed.storable\  s     zra   c                    dS r  r   r   s    r_   r  zFixed.is_existsa  r  ra   c                .    t          | j        dd           S )NrE  )r  r[  r   s    r_   rE  zFixed.nrowse  s    t}gt444ra   Literal[True] | Nonec                    |dS dS )z%validate against an existing storableNTr   rL  s     r_   r
  zFixed.validatei  s    =4tra   Nc                    dS )+are we trying to operate on an old version?Nr   r   ru   s     r_   validate_versionzFixed.validate_versiono  rV  ra   c                D    | j         }|dS |                                  dS )zr
        infer the axes of my storer
        return a boolean indicating if we have a valid storer or not
        NFT)r[  rX  )r   rB  s     r_   rG  zFixed.infer_axesr  s*    
 M95tra   r   r   r   Series | DataFramec                     t          d          )Nz>cannot read on an abstract storer: subclasses should implementr   r   ru   r   r   r   s        r_   r>  z
Fixed.read}  s     "L
 
 	
ra   c                     t          d          )Nz?cannot write on an abstract storer: subclasses should implementrg  r   r  r   s      r_   r   zFixed.write  s    !M
 
 	
ra   c                    t          j        |||          r#| j                            | j        d           dS t          d          )zs
        support fully deleting the node in its entirety (only) - where
        specification must be None
        Try  Nz#cannot delete on an abstract storer)r~  r  r   r  r   r   )r   ru   r   r   s       r_   r  zFixed.delete  sK     <ud++ 	L$$TZ4$@@@4=>>>ra   )rV   r   )
r   r   r   rM   rW   rX   r   rZ   rY   r   r  )rY   r6  r  r  )rY   r+  r  )rY   r^  r\   NNNN)r   r   r   r   rY   re  r  r   r   r   r   rY   r   )!r   r  r  r  r  r-  rm  r   r  r5  r4  r  r	  r  r  r  rn  r   r   r   r   ru  rU  rX  r[  r  rE  r
  rc  rG  r>  r   r  r   ra   r_   r+  r+  
  s        
 
 K&&&&IIIH  '     V V V XV 
 
 
 X
 A A XA	  	  	  	 2 2 2 2
      X & & X& # # X# $ $ X$ & & & X& ' ' ' X' # # X#( ( ( (( ( ( (   X    X 5 5 X5   : : : : :	 	 	 	  	
 	
 	
 	
 	

 
 
 
 HL? ? ? ? ? ? ?ra   r+  c                     e Zd ZU dZedediZd e                                D             Zg Z	de
d<   d+d	Zd
 Zd Zd,dZed-d            Zd,dZd,dZd,dZd.d/dZ	 d.d0dZd1dZd2dZ	 d.d3dZ	 d.d4d"Zd5d%Z	 d6d7d*ZdS )8GenericFixedza generified fixed versiondatetimer  c                    i | ]\  }}||	S r   r   )rn   rW  r  s      r_   r  zGenericFixed.<dictcomp>  s    CCC41a!QCCCra   r  
attributesrY   rZ   c                8    | j                             |d          S )N )_index_type_mapr   )r   r  s     r_   _class_to_aliaszGenericFixed._class_to_alias  s    #''R000ra   c                p    t          |t                    r|S | j                            |t                    S r\   )rc   r   _reverse_index_mapr   r/   )r   aliass     r_   _alias_to_classzGenericFixed._alias_to_class  s2    eT"" 	L&**5%888ra   c                   |                      t          |dd                    }i }|t          k    rd	d}|}n|t          k    rd	d}|}n|}d|d<   d|v r|d         |d<   |t          u rt
          }d|v r|d         |d<   |t          u sJ ||fS )
Nindex_classrt  c                    t          j        | j        | j        |          }t	          j        |d           }|(|                    d                              |          }|S )N)r]  r(  rd   rb  )r9   _simple_newr  r]  r.   rj  rk  )r  r(  r)  dtaresults        r_   r|   z*GenericFixed._get_index_factory.<locals>.f  sf    #/MD   '23TBBB>#//66AA"EEFra   c                x    t          |          }t          j        | |          }t          j        |d           S )Nr   rd   )r+   r:   r~  r1   )r  r(  r)  r]  parrs        r_   r|   z*GenericFixed._get_index_factory.<locals>.f  s:    #D))".vUCCC".t$????ra   Fr  r(  r)  r  )rz  r  r.   r1   r/   r5   )r   ru  r|  r   r|   rm  s         r_   _get_index_factoryzGenericFixed._get_index_factory  s    **75-+L+LMM -''    GGK''@ @ @ @
 GG!G"F6NU??"6]F6Ne##(5== ;F4L-////ra   r   c                J    |t          d          |t          d          dS )zE
        raise if any keywords are passed which are not-None
        Nzqcannot pass a column specification when reading a Fixed format store. this store must be selected in its entiretyzucannot pass a where specification when reading from a Fixed format store. this store must be selected in its entirety)r   )r   r   ru   s      r_   validate_readzGenericFixed.validate_read  sJ     T   Y   ra   r   c                    dS )NTr   r   s    r_   r  zGenericFixed.is_exists  s    tra   c                J    | j         | j        _         | j        | j        _        dS rT  )rW   ru  r   r   s    r_   rU  zGenericFixed.set_attrs  s     "m
 K
ra   c           
         t          t          | j        dd                    | _        t          | j        dd          | _        | j        D ]'}t          | |t          | j        |d                     (dS )retrieve our attributesrW   Nr   r   )r`   r  ru  rW   r   rr  r  )r   r  s     r_   rX  zGenericFixed.get_attrs  sr    (Z)N)NOOdj(H== 	; 	;AD!WTZD99::::	; 	;ra   c                .    |                                   d S r\   )rU  rj  s      r_   r   zGenericFixed.write  s    ra   Nr   r   r   r   c                   ddl }t          | j        |          }|j        }t          |dd          }t	          ||j                  r5|d         ||         }t          |dd          }	|	t          ||	          }nt          |dd          }	t          |dd          }
|
t          j        |
|	          }n
|||         }|	r8|		                    d          r#t          |d	d          }t          |||	          }nJ|	rH|		                    d
          r3|	d
k    rt          j        |d          }nt          j        ||	          }|r|j        S |S )z2read an array for the specified node (off of groupr   N
transposedF
value_typer   r  r  r)  r  r  )r   r  r   r  rc   VLArraypd_arrayrc  r  r  r  r  T)r   r   r   r   r   r  ru  r  retr]  r  r)  s               r_   
read_arrayzGenericFixed.read_array  sy   tz3''UL%88
dFN++ 	7q'%*%CE<66E s%000E<66EE7D11E huE2225:& 7)),77 7UD$//c2u-- 75++M:: 7M)) *S999CC*S666C 	5LJra   r/   c                    t          | j        | d          }|dk    r|                     |||          S |dk    r/t          | j        |          }|                     |||          }|S t          d|           )N_varietymultir   r   regularzunrecognized index variety: )r  ru  read_multi_indexr   read_index_noder   )r   r   r   r   varietyr  r   s          r_   
read_indexzGenericFixed.read_index#  s     $*&6&6&677g((E(EEE	!!4:s++D((U(FFELD7DDEEEra   r   c                   t          |t                    r1t          | j        | dd           |                     ||           d S t          | j        | dd           t          d|| j        | j                  }|                     ||j	                   t          | j        |          }|j        |j        _        |j        |j        _        t          |t          t           f          r,|                     t%          |                    |j        _        t          |t          t           t(          f          r|j        |j        _        t          |t                    r'|j        "t/          |j                  |j        _        d S d S d S )Nr  r  r  r   )rc   r0   r  ru  write_multi_index_convert_indexrW   r   write_arrayr  r  r   r  r  re   r.   r1   rv  r   r|  r5   r(  r)  _get_tz)r   r   r   r  r  s        r_   write_indexzGenericFixed.write_index1  sa   eZ(( 	5DJ3 0 0 0':::""3.....DJ3 0 0 0)<<<&wt}dkRRIS)"23334:s++D!*DM!&DM%-!=>> N,0,@,@e,M,M)%-n!MNN 0%*Z"%// 5EH4H#*58#4#4   5 54H4Hra   r0   c                   t          | j        | d|j                   t          t	          |j        |j        |j        d                    D ]\  }\  }}}t          |j	        t                    r)t          |j	        t                    st          d          | d| }t          ||| j        | j                  }|                     ||j                   t%          | j        |          }	|j        |	j        _        ||	j        _        t          |	j        | d| |           | d| }
|                     |
|           d S )N_nlevelsTrX  z=Saving a MultiIndex with an extension dtype is not supported._level_name_label)r  ru  r  	enumeraterl  levelsr  namesrc   r]  r*   r4   r   r  rW   r   r  r  r  r   r  r  re   )r   r   r   ilevlevel_codesre   	level_key
conv_levelr  	label_keys              r_   r  zGenericFixed.write_multi_indexH  sm   
s,,,em<<<+4ek5;tDDD,
 ,
 	5 	5'A'[$ #)^44 Z	;> >  *S   ))a))I'	3t{SSJY
(9:::4:y11D!+DM!%DM DMc#6#6#6#6=== ))a))IY4444-	5 	5ra   c                   t          | j        | d          }g }g }g }t          |          D ]}| d| }	t          | j        |	          }
|                     |
||          }|                    |           |                    |j                   | d| }|                     |||          }|                    |           t          |||d          S )Nr  r  r  r  T)r  r  r  re  )	r  ru  r  r   r  r   re   r  r0   )r   r   r   r   r  r  r  r  r  r  r  r  r  r  s                 r_   r  zGenericFixed.read_multi_indexc  s    $*&6&6&677 "w 		& 		&A))a))I4:y11D&&t5t&DDCMM#LL"""))a))I//)5t/LLKLL%%%%ed
 
 
 	
ra   r  rM   c           	     P   |||         }d|j         v rLt          j        |j         j                  dk    r*t          j        |j         j        |j         j                  }|j         j        }d }d|j         v rt          |j         j                  }|j         }| 	                    |          \  }}	|dv r, |t          ||| j        | j                  fdt          i|	}
n	  |t          ||| j        | j                  fi |	}
n# t          $ r}| j        dk    rwt                      rit!          |                              d	          rGt$          r@ |t          ||| j        | j                  fdt'          d
t          j                  i|	}
n Y d }~nd }~ww xY w||
_        |
S )Nr  r   r   re   )r   rD  r  r]  r[  r\  r^  r_  )r  rc  prodr  r  r  r  rf   re   r  _unconvert_indexrW   r   rD  rh  r   rZ   r  r   r4   ri  )r   r  r   r   r  r  re   ru  rm  r   r   r  s               r_   r  zGenericFixed.read_index_nodez  s     E$J dm##0C(D(D(I(I8DM/t}7OPPPD}!T]""t}122D11%88%%%G $t{    	
  EE$dT]4;    	  &   K?22*,, 3C))*BCC 3 $ 3
 $G( $t{    *(RVLLL	
 ! EE  EEEE" 
s    $D 
FBFFr   rO   c                   t          j        d|j        z            }| j                            | j        ||           t          | j        |          }t          |j                  |j	        _
        |j        |j	        _        dS )zwrite a 0-len arrayrk   N)rc  r  r  r   create_arrayr   r  rZ   r]  r  r  r  )r   r   r   arrr  s        r_   write_array_emptyzGenericFixed.write_array_empty  sm     htej())!!$*c3777tz3''#&u{#3#3 #kra   r  rN   r)  Index | Nonec                Z	   t          |d          }|| j        v r | j                            | j        |           |j        dk    }d}t          |j        t                    rt          d          |st          |d          r	|j
        }d}d }| j        Wt          t                    5  t                      j                            |j                  }d d d            n# 1 swxY w Y   |Q|s7| j                            | j        |||j        | j                  }||d d <   ne|                     ||           nM|j        j        t*          j        k    rt/          j        |d          }	|rnK|	d	k    rnDt3          d
          r5t4          |	||fz  }
t7          j        |
t:          t=                                 | j                            | j        |t                                                                 }|!                    |           nyt/          j"        |j        d          rg| j        #                    | j        ||$                    d                     tK          |j                  tM          | j        |          j'        _(        nt          |j        tR                    ru| j        #                    | j        ||j*                   tM          | j        |          }tW          |j,                  |j'        _,        d|j        j-         d|j'        _(        nit/          j"        |j        d          rf| j        #                    | j        ||$                    d                     tK          |j                  tM          | j        |          j'        _(        nt          |t\                    r| j                            | j        |t                                                                 }|!                    |/                                           tM          | j        |          }tK          |j                  |j'        _(        n:|r|                     ||           n!| j        #                    | j        ||           |tM          | j        |          j'        _0        d S )NT)extract_numpyr   Fz^Cannot store a category dtype in an HDF5 dataset that uses format="fixed". Use format="table".r  )r   skipnar  performance_warningsr  rU  rV  datetime64[rY  r  )1r@   r   r   r  r  rc   r]  r(   r   rQ  r  r   r   r   r   Atom
from_dtypecreate_carrayr  r  r   rc  object_r   infer_dtyper   ry   r  r  r   r!   create_vlarray
ObjectAtomr   rg  r  viewrZ   r  r  r  r)   asi8r  r)  unitr<   to_numpyr  )r   r   r  r)  r   empty_arrayr  r  cainferred_typer  vlarrr  s                r_   r  zGenericFixed.write_array  s}    c666$*L$$TZ555 jAo
ek#344 	%/    	"uc"" "!
=$*%% > >yy~00==> > > > > > > > > > > > > > > 
  3\//JT5; 0   111 &&sE2222[++  OE%@@@M U(**233 U$sE'BBb"4AQASASTTTTL//
CAUAUAWAWXXELL_U[#.. 	>L%%dj#uzz$7G7GHHH;>u{;K;KGDJ$$-88_55 	>
 L%%

   4:s++D&ux00DM'HU[5E'H'H'HDM$$_U[#.. 	>L%%dj#uzz$7G7GHHH;>u{;K;KGDJ$$-88// 	>L//
CAUAUAWAWXXELL))***4:s++D'*5;'7'7DM$$ 	>""3....L%%dj#u===7A
C  )444s   ),C!!C%(C%r  r  r  r  r  )r   rZ   r   r   r   r   rY   r/   )r   rZ   r   r/   rY   r   )r   rZ   r   r0   rY   r   )r   rZ   r   r   r   r   rY   r0   )r  rM   r   r   r   r   rY   r/   )r   rZ   r   rO   rY   r   r\   )r   rZ   r  rN   r)  r  rY   r   )r   r  r  r  r.   r1   ru  r)  rx  rr  r  rv  rz  r  r  r  r  rU  rX  r   r  r  r  r  r  r  r  r  r   ra   r_   ro  ro    s        $$$j+xHOCC?+@+@+B+BCCCJ1 1 1 19 9 9) ) )V       X( ( ( (
; ; ; ;   ( ( ( ( (V FJF F F F F5 5 5 5.5 5 5 58 FJ
 
 
 
 
0 HL4 4 4 4 4l* * * * BF]B ]B ]B ]B ]B ]B ]Bra   ro  c                  `     e Zd ZU dZdgZded<   edd            Z	 	 	 	 dddZd fdZ	 xZ
S )r  r  re   rF   rY   tuple[int] | Nonec                h    	 t          | j        j                  fS # t          t          f$ r Y d S w xY wr\   )rt   r   r  r   r   r   s    r_   r  zSeriesFixed.shape  sD    	
)**,,>* 	 	 	44	s    11Nr   r   r   r3   c                   |                      ||           |                     d||          }|                     d||          }	 t          ||| j        d          }n# t
          $ r}| j        dk    rjt                      r\t          |          	                    d          r:t          r3t          ||| j        dt          dt          j        	          
          }n Y d }~nd }~ww xY w|S )Nr   r  r  F)r   re   r  r[  r\  r^  r_  )r   re   r  r]  )r  r  r  r3   re   rh  r   r   rZ   r  r   r4   rc  ri  )	r   ru   r   r   r   r   r  r  r  s	            r_   r>  zSeriesFixed.read&  s    	7E***u4@@TBB	F%dieLLLFF! 	 	 	..&(( /HH%%&>?? /   /
  %hHHH    	  s   A! !
C++A6C&&C+r   c                     t                      j        |fi | |                     d|j                   |                     d|           |j        | j        _        d S )Nr   r  )r  r   r  r   r  re   ru  )r   r  r   r  s      r_   r   zSeriesFixed.writeD  s^    c$$V$$$#),,,3'''(
ra   )rY   r  rl  r   r   r   r   rY   r3   r  )r   r  r  r,  rr  r  r  r  r>  r   r  r  s   @r_   r  r    s         KJNNN   X      <# # # # # # # # # #ra   r  c                  ^     e Zd ZU ddgZded<   edd            Z	 	 	 	 dddZd fdZ xZ	S )BlockManagerFixedr  nblocksri   rY   list[int] | Nonec                z   	 | j         }d}t          | j                  D ]9}t          | j        d| d          }t          |dd           }|||d         z  }:| j        j        }t          |dd           }|t          |d|dz
                     }ng }|                    |           |S # t          $ r Y d S w xY w)Nr   block_itemsr  rk   )	r  r  r  r  r   block0_valuesrr   r   r   )r   r  r)  r  r  r  s         r_   r  zBlockManagerFixed.shapeP  s    	9D E4<(( & &tz+<1+<+<+<==gt44$U1X%E :+DD'400E U1q>233LLL 	 	 	44	s   B)B, ,
B:9B:Nr   r   r   r-   c                   |                      ||           |                                                     d          }g }t          | j                  D ]A}||k    r||fnd\  }}	|                     d| ||	          }
|                    |
           B|d         }g }t          | j                  D ]}|                     d| d          }|                     d| d||	          }||	                    |                   }t          |j        ||d         d	
          }t                      rXt          |t          j                  r>t!          |d          r-|                    t%          t          j                            }|                    |           t)          |          dk    r9t+          |d                                          }|                    |          S t          |d         |d                   S )Nr   r  rd  r  r  r  r  rk   Fr   r   r  Tr  )ra  r  r  r   r   )r  r/  _get_block_manager_axisr  r  r  r   r  r  r  r-   r  r   rc   rc  rd  r   r  r4   ri  rt   r6   r  r  )r   ru   r   r   r   select_axisr  r  r?  r@  axr)  dfs	blk_itemsr  dfouts                    r_   r>  zBlockManagerFixed.readk  s    	7E***mmoo==a@@ty!! 	 	A-.+-=-=UDMM<MFE6FFBKKOOOOQt|$$ 	 	A(9(9(9(9::I__%7Q%7%7%7vE_RRFE--i889G68WDG%PPPB"$$=vrz22= $F4888=
 YY{BF;;;<<JJrNNNNs88a<<1%%%**,,C;;u;---aQ8888ra   r   c                ~    t                      j        |fi | |j        }|                                s|                                }|j        | j        _        t          |j                  D ]:\  }}|dk    r|j	        st          d          |                     d| |           ;t          |j                  | j        _        t          |j                  D ]_\  }}|j                            |j                  }|                     d| d|j        |           |                     d| d|           `d S )Nr   z/Columns index has to be unique for fixed formatrd  r  r  )r)  r  )r  r   _mgris_consolidatedconsolidater  ru  r  r  	is_uniquer   r  rt   blocksr  r)  r  mgr_locsr  r  )	r   r  r   r  r  r  blkr  r  s	           r_   r   zBlockManagerFixed.write  sR   c$$V$$$x##%% 	&##%%D)
ty)) 	- 	-EArAvvr|v !RSSSZAZZ,,,, !--
,, 	; 	;FAs
55I/Q///9MMM.Q...	::::		; 	;ra   )rY   r  rl  r   r   r   r   rY   r-   r  )
r   r  r  rr  r  r  r  r>  r   r  r  s   @r_   r  r  K  s         )$JLLL   X8  &9 &9 &9 &9 &9P; ; ; ; ; ; ; ; ; ;ra   r  c                      e Zd ZdZeZdS )r  r  N)r   r  r  r,  r-   r/  r   ra   r_   r  r    s        KHHHra   r  c                      e Zd ZU dZdZdZded<   ded<   dZded	<   d
Zded<   	 	 	 	 	 	 	 	 dfdg fd"Z	e
dhd#            Zdhd$Zdid&Zdjd'Ze
dkd)            Zdld-Ze
dmd/            Ze
dkd0            Ze
d1             Ze
d2             Ze
d3             Ze
d4             Ze
dnd6            Ze
dmd7            Ze
dkd8            Ze
dod:            Zdpd<Zdqd>Zdrd@ZdsdBZdtdEZdudFZ djdGZ!djdHZ"dvdjdIZ#djdJZ$e%dK             Z&	 dwdxdMZ'	 dydzdRZ(e)d{dT            Z*d|dUZ+	 	 	 	 d}d~dXZ,e-dd[            Z.dvdd^Z/ddbZ0	 dwddcZ1	 	 	 dwddeZ2 xZ3S )r  aa  
    represent a table:
        facilitate read/write of various types of tables

    Attrs in Table Node
    -------------------
    These are attributes that are store in the main table node, they are
    necessary to recreate these tables when read back in.

    index_axes    : a list of tuples of the (original indexing axis and
        index column)
    non_index_axes: a list of tuples of the (original index axis and
        columns on a non-indexing axis)
    values_axes   : a list of the columns which comprise the data of this
        table
    data_columns  : a list of the columns that we are allowing indexing
        (these become single columns in values_axes)
    nan_rep       : the string to use for nan representations for string
        objects
    levels        : the names of levels
    metadata      : the names of the metadata columns
    
wide_tabler{   rZ   r-  r  rk   zint | list[Hashable]r  Trr   r/  Nr   r   r   r   rM   rW   rX   r   
index_axeslist[IndexCol] | Noner_   list[tuple[AxisInt, Any]] | Nonevalues_axeslist[DataCol] | Noner   list | Noner  dict | NonerY   r   c                    t                                          ||||           |pg | _        |pg | _        |pg | _        |pg | _        |	pi | _        |
| _        d S )Nr  )r  r   r  r_  r  r   r  r   )r   r   r   rW   r   r  r_  r  r   r  r   r  s              r_   r   zTable.__init__  so     	&III$*,2&,"(.BJB	ra   c                B    | j                             d          d         S )N_r   )r  r  r   s    r_   table_type_shortzTable.table_type_short  s    $$S))!,,ra   c                   |                                   t          | j                  rd                    | j                  nd}d| d}d}| j        r*d                    d | j        D                       }d| d}d                    d | j        D                       }| j        d	| d
| j         d| j	         d| j
         d| d| dS )r@  r:  rt  z,dc->[rY  r;  c                ,    g | ]}t          |          S r   rZ   r[  s     r_   rq   z"Table.__repr__.<locals>.<listcomp>  s    :::SVV:::ra   rC  c                    g | ]	}|j         
S r   rd   r  s     r_   rq   z"Table.__repr__.<locals>.<listcomp>  s    @@@1@@@ra   rD  z (typ->z,nrows->z,ncols->z,indexers->[rE  )rG  rt   r   r@  r5  r4  r  r  r  rE  ncols)r   jdcr  verjverjindex_axess         r_   r	  zTable.__repr__  s#   -01B-C-CKchht()))c___ 	88::T\:::;;Dd+++Chh@@@@@AA- Bs B B*B B48JB BjB B.9B B<>B B B	
ra   r  c                8    | j         D ]}||j        k    r|c S dS )zreturn the axis for cN)r  re   )r   r  r   s      r_   r   zTable.__getitem__  s1     	 	AAF{{ tra   c                   |dS |j         | j         k    r t          d|j          d| j          d          dD ]}t          | |d          }t          ||d          }||k    rt          |          D ]p\  }}||         }||k    r]|dk    r>|j        |j        k    r.t          d|j        d          d	|j         d
|j         d          t          d| d| d| d          qt          d| d| d| d          dS )z"validate against an existing tableNz'incompatible table_type with existing [r  rY  )r  r_  r  r  Cannot serialize the column [r   z%] because its data contents are not [z] but [] object dtypezinvalid combination of [z] on appending data [z] vs current table [)r  r   r  r  r  r   r  r|  )r   rC  r  svovr  saxoaxs           r_   r
  zTable.validate   s   =Ft..<$< <)-< < <  
 A 	 	Aq$''B4((BRxx (mm  FAsQ%Cczz--#(ch2F2F",!A
1 !A !AFIh!A !A(+!A !A !A# # 
 )@q @ @ #@ @9<@ @ @   "  ,q , ,r , ,&(, , ,  ) 	 	ra   r   c                6    t          | j        t                    S )z@the levels attribute is 1 or a list in the case of a multi-index)rc   r  rr   r   s    r_   is_multi_indexzTable.is_multi_index'  s     $+t,,,ra   r  r    tuple[DataFrame, list[Hashable]]c                    t          j        |j        j                  }	 |                                }n"# t
          $ r}t          d          |d}~ww xY wt          |t                    sJ ||fS )ze
        validate that we can store the multi-index; reset and return the
        new object
        zBduplicate names/columns in the multi-index when storing as a tableN)r~  fill_missing_namesr   r  reset_indexr   rc   r-   )r   r  r  	reset_objr  s        r_   validate_multiindexzTable.validate_multiindex,  s     '	88	))II 	 	 	T 	 )Y/////&  s   5 
AAAri   c                H    t          j        d | j        D                       S )z-based on our axes, compute the expected nrowsc                2    g | ]}|j         j        d          S r^  )r  r  rn   r  s     r_   rq   z(Table.nrows_expected.<locals>.<listcomp>@  s!    DDDq	*DDDra   )rc  r  r  r   s    r_   nrows_expectedzTable.nrows_expected=  s%     wDDDODDDEEEra   c                    d| j         v S )zhas this table been createdr{   rZ  r   s    r_   r  zTable.is_existsB  s     $*$$ra   c                .    t          | j        dd           S Nr{   r  r   r   s    r_   r[  zTable.storableG  s    tz7D111ra   c                    | j         S )z,return the table group (this is my storable))r[  r   s    r_   r{   zTable.tableK  s     }ra   c                    | j         j        S r\   )r{   r]  r   s    r_   r]  zTable.dtypeP  s    zra   c                    | j         j        S r\   rx  r   s    r_   ry  zTable.descriptionT  rz  ra   itertools.chain[IndexCol]c                @    t          j        | j        | j                  S r\   )rj  rk  r  r  r   s    r_   r  z
Table.axesX  s    t0@AAAra   c                >    t          d | j        D                       S )z.the number of total columns in the values axesc              3  >   K   | ]}t          |j                  V  d S r\   )rt   r  r  s     r_   r  zTable.ncols.<locals>.<genexpr>_  s*      ;;Q3qx==;;;;;;ra   )sumr  r   s    r_   r  zTable.ncols\  s$     ;;$*:;;;;;;ra   c                    dS r  r   r   s    r_   is_transposedzTable.is_transposeda  r  ra   tuple[int, ...]c                    t          t          j        d | j        D             d | j        D                                 S )z@return a tuple of my permutated axes, non_indexable at the frontc                8    g | ]}t          |d                    S r^  r:  r  s     r_   rq   z*Table.data_orientation.<locals>.<listcomp>j  s"    888qQqT888ra   c                6    g | ]}t          |j                  S r   )ri   rd  r  s     r_   rq   z*Table.data_orientation.<locals>.<listcomp>k  s     666QV666ra   )rs   rj  rk  r_  r  r   s    r_   data_orientationzTable.data_orientatione  sL     O88D$788866do666 
 
 	
ra   dict[str, Any]c                     dddd  j         D             }fd j        D             } fd j        D             }t          ||z   |z             S )z<return a dict of the kinds allowable columns for this objectr   r   r   rk   c                     g | ]}|j         |fS r   r+  r  s     r_   rq   z$Table.queryables.<locals>.<listcomp>u  s    444qqwl444ra   c                *    g | ]\  }}|         d fS r\   r   )rn   rd  r  
axis_namess      r_   rq   z$Table.queryables.<locals>.<listcomp>v  s'    OOO<4z$&OOOra   c                X    g | ]&}|j         t          j                  v |j        |f'S r   )re   r  r   r+  )rn   r  r   s     r_   rq   z$Table.queryables.<locals>.<listcomp>w  s=     
 
 
afDDU@V@V6V6VQWaL6V6V6Vra   )r  r_  r  r  )r   d1d2d3r4  s   `   @r_   
queryableszTable.queryableso  s     !Y//
 54DO444OOOO4;NOOO
 
 
 
"&"2
 
 
 BGbL!!!ra   list[tuple[Any, Any]]c                $    d | j         D             S )zreturn a list of my index colsc                *    g | ]}|j         |j        fS r   )rd  r+  r  s     r_   rq   z$Table.index_cols.<locals>.<listcomp>  s!    ;;;a!;;;ra   r  r   s    r_   
index_colszTable.index_cols}  s     <;4?;;;;ra   r  c                $    d | j         D             S )zreturn a list of my values colsc                    g | ]	}|j         
S r   r2  r  s     r_   rq   z%Table.values_cols.<locals>.<listcomp>  s    222A222ra   )r  r   s    r_   values_colszTable.values_cols  s    22!12222ra   r   c                *    | j         j        }| d| dS )z)return the metadata pathname for this keyz/meta/z/metarM  r:  s      r_   _get_metadata_pathzTable._get_metadata_path  s#    
&))s))))ra   r  rR  c                    | j                             |                     |          t          |d          d| j        | j        | j                   dS )z
        Write out a metadata array to the key as a fixed-format Series.

        Parameters
        ----------
        key : str
        values : ndarray
        Fr  r{   )r   rW   r   r   N)r   r   rC  r3   rW   r   r   )r   r   r  s      r_   r  zTable.write_metadata  s^     	##C((6&&&];L 	 	
 	
 	
 	
 	
ra   c                    t          t          | j        dd          |d          -| j                            |                     |                    S dS )z'return the meta data array for this keyr   N)r  r   r   r   rC  r   s     r_   r  zTable.read_metadata  sK    74:vt44c4@@L;%%d&=&=c&B&BCCCtra   c                   t          | j                  | j        _        |                                 | j        _        |                                 | j        _        | j        | j        _        | j        | j        _        | j        | j        _        | j        | j        _        | j	        | j        _	        | j
        | j        _
        | j        | j        _        dS )zset our table type & indexablesN)rZ   r  ru  r>  rA  r_  r   r   rW   r   r  r  r   s    r_   rU  zTable.set_attrs  s     #DO 4 4
 $ 1 1
!%!1!1!3!3
$($7
!"&"3
!\
"m
 K
 K
)
ra   c                   t          | j        dd          pg | _        t          | j        dd          pg | _        t          | j        dd          pi | _        t          | j        dd          | _        t          t          | j        dd                    | _        t          | j        dd          | _        t          | j        d	d          pg | _	        d
 | j
        D             | _        d | j
        D             | _        dS )r  r_  Nr   r  r   rW   r   r   r  c                     g | ]}|j         	|S r   r&  r  s     r_   rq   z#Table.get_attrs.<locals>.<listcomp>       KKK9JK1KKKra   c                     g | ]}|j         	|S r   rI  r  s     r_   rq   z#Table.get_attrs.<locals>.<listcomp>       PPP!a>OPAPPPra   )r  ru  r_  r   r  r   r`   rW   r   r  
indexablesr  r  r   s    r_   rX  zTable.get_attrs  s    %dj2BDIIOR#DJEEKDJ55;	tz9d;;(Z)N)NOOdj(H==&-dj(D&I&I&ORKKdoKKKPPtPPPra   c                    |]| j         rXt          d                    d | j        D                       z  }t	          j        |t          t                                 dS dS dS )ra  Nr;  c                ,    g | ]}t          |          S r   r   r[  s     r_   rq   z*Table.validate_version.<locals>.<listcomp>  s    4R4R4RSVV4R4R4Rra   r  )r5  rw   r@  r4  r  r  r   r!   )r   ru   r  s      r_   rc  zTable.validate_version  s~    " (3884R4RT\4R4R4R+S+SS*/11       ra   c                    |dS t          |t                    sdS |                                 }|D ] }|dk    r	||vrt          d| d          !dS )z
        validate the min_itemsize doesn't contain items that are not in the
        axes this needs data_columns to be defined
        Nr  zmin_itemsize has the key [z%] which is not an axis or data_column)rc   r  r9  r   )r   r   qrW  s       r_   validate_min_itemsizezTable.validate_min_itemsize  s    
 F,-- 	FOO 	 	AH}}zz " " " "   		 	ra   c                .    g } j          j        j        t           j        j                  D ]z\  }\  }}t          |          }                     |          }|dnd}| d}t          |d          }	t          ||||	| j        ||          }
|                    |
           {t           j
                  t          |          d fd	|                    fd
t           j        j                  D                        |S )z/create/cache the indexables if they don't existNr  r4  )re   rd  r.  r  r-  r{   r   r/  r  rZ   rY   r  c                   t          |t                    sJ t          }|v rt          }t	          |          }t          |j                  }t	          | dd           }t	          | dd           }t          |          }                    |          }t	          | dd           }	 |||||| z   |j	        |	||
  
        }
|
S )Nr4  r  r  )
re   r+  r  r  r.  r-  r{   r   r/  r]  )
rc   rZ   r  r   r  _maybe_adjust_namer4  r  r  r{   )r  r  klassr  adj_namer  r]  r  mdr   r  base_posr  descr   table_attrss              r_   r|   zTable.indexables.<locals>.f  s   a%%%%%EBww(4##D)!T\::H [X*<*<*<dCCFKH)<)<)<dCCE "%((D##A&&B ;8(:(:(:DAAD%qLj  C Jra   c                .    g | ]\  }} ||          S r   r   )rn   r  r  r|   s      r_   rq   z$Table.indexables.<locals>.<listcomp>$  s'    RRR1AAaGGRRRra   )r  rZ   rY   r  )ry  r{   ru  r  r>  r  r  r%  r   r  r   rt   r  rA  )r   _indexablesr  rd  re   r  rX  r   r5  r  	index_colrY  r  rZ  r|   r[  s   `          @@@@@r_   rM  zTable.indexables  si    j&
  ))>?? 	* 	*OA|d4&&D##D))B!#::TDI;	488D j	 	 	I y)))) "##{##!	 !	 !	 !	 !	 !	 !	 !	 !	 !	J 	RRRR	$*:P0Q0QRRRSSSra   r  c           
        |                                  sdS |du rdS ||du rd | j        D             }t          |t          t          f          s|g}i }|||d<   |||d<   | j        }|D ]}t          |j        |d          }||j        rY|j	        }|j
        }	|j        }
||
|k    r|                                 n|
|d<   ||	|k    r|                                 n|	|d<   |j        s6|j                            d          rt          d           |j        di | || j        d	         d
         v rt%          d| d| d| d          dS )aZ  
        Create a pytables index on the specified columns.

        Parameters
        ----------
        columns : None, bool, or listlike[str]
            Indicate which columns to create an index on.

            * False : Do not create any indexes.
            * True : Create indexes on all columns.
            * None : Create indexes on all columns.
            * listlike : Create indexes on the given columns.

        optlevel : int or None, default None
            Optimization level, if None, pytables defaults to 6.
        kind : str or None, default None
            Kind of index, if None, pytables defaults to "medium".

        Raises
        ------
        TypeError if trying to create an index on a complex-type column.

        Notes
        -----
        Cannot index Time64Col or ComplexCol.
        Pytables must be >= 3.0.
        NFTc                *    g | ]}|j         	|j        S r   )r'  r+  r  s     r_   rq   z&Table.create_index.<locals>.<listcomp>M  s"    III1Q5HIqwIIIra   r  r  complexzColumns containing complex values can be stored but cannot be indexed when using table format. Either use fixed format, set index=False, or do not include the columns containing complex values to data_columns when initializing the table.r   rk   zcolumn z/ is not a data_column.
In order to read column z: you must reload the dataframe 
into HDFStore and include z  with the data_columns argument.r   )rG  r  rc   rs   rr   r{   r  r  r  r   r  r  remove_indexr   r  r   r  r_  r   )r   r   r  r  kwr{   r  r  r   cur_optlevelcur_kinds              r_   r  zTable.create_index(  s   <    	FeF ?gooII	IIIG'E4=11 	 iG%BzNBvJ
 $	 $	A
At,,A}< 6GE#(>L$zH'H,<,<((((%-6
+0H0H(((()5: | 	)v((33 'H   #AN((R(((d)!,Q///$Ua U U/0U U12U U U   0=$	 $	ra   r   r   r   9list[tuple[np.ndarray, np.ndarray] | tuple[Index, Index]]c                   t          | |||          }|                                }g }| j        D ]Y}|                    | j                   |                    || j        | j        | j                  }|	                    |           Z|S )a  
        Create the axes sniffed from the table.

        Parameters
        ----------
        where : ???
        start : int or None, default None
        stop : int or None, default None

        Returns
        -------
        List[Tuple[index_values, column_values]]
        rL  r  )
	Selectionr   r  r  r  rp  r   rW   r   r   )	r   ru   r   r   	selectionr  r"  r   ress	            r_   
_read_axeszTable._read_axes~  s    " d%u4HHH	!!## 	  	 AJJty!!!)){	   C NN3ra   r  c                    |S )zreturn the data for this objr   r  r  r  s      r_   
get_objectzTable.get_object  s	     
ra   c                   t          |          sg S |d         \  }| j                            |i           }|                    d          dk    r|rt          d| d|           |du rt	                    }n|g }t          |t                    rQt          |          t	          |          }|                    fd|	                                D                        fd	|D             S )
zd
        take the input data_columns and min_itemize and create a data
        columns spec
        r   r   r0   z"cannot use a multi-index on axis [z] with data_columns TNc                (    g | ]}|d k    |v|S rr  r   )rn   rW  existing_data_columnss     r_   rq   z/Table.validate_data_columns.<locals>.<listcomp>  s7       H}}2G)G)G )G)G)Gra   c                    g | ]}|v |	S r   r   )rn   r  axis_labelss     r_   rq   z/Table.validate_data_columns.<locals>.<listcomp>  s#    <<<a1+;+;+;+;+;ra   )
rt   r  r   r   rr   rc   r  r  r  r!  )r   r   r   r_  rd  r  rs  rq  s         @@r_   validate_data_columnszTable.validate_data_columns  sG   
 >"" 	I*1-ky}}T2&&88F|+++/T / / ,/ /   4,,LL!L lD)) 		$'$5$5!--L   )..00     =<<<<<<<<ra   r-   r
  c                   t          t                    s/| j        j        }t	          d| dt                     d          dgfdD             |                                 r/d}d | j        D             t          | j	                  }| j
        }nd	}| j        }	| j        d
k    sJ t                    | j        dz
  k    rt          d          g }
|d}t          fddD                       }j        |         }t          |          }|rt          |
          }| j        |         d         }t%          t'          j        |          t'          j        |          dd          sSt%          t'          j        t+          |                    t'          j        t+          |                    dd          r|}|	                    |i           }t          |j                  |d<   t          |          j        |d<   |
                    ||f           d         }j        |         }                    |          }t7          ||| j        | j                  }||_        |                    d           |                     |	           |!                    |           |g}t          |          }|dk    sJ t          |
          dk    sJ |
D ]}tE          |d         |d                    |j        dk    }| #                    |||
          }| $                    |          %                                }| &                    |||
| j'        |          \  }}g }tQ          tS          ||d                    D ]/\  }\  }}tT          }d}|rRt          |          dk    r?|d         |v r5tV          }|d         }|$t          |tX                    st          d          |rF|rD	 | j'        |         }n7# tZ          t\          f$ r!} t          d| d| j'         d          | d} ~ ww xY wd}|pd| }!t_          |!|j0        |||| j        | j        |          }"tc          |!| j2                  }#|3                    |"          }$ti          |"j5        j6                  }%d}&to          |"dd          tq          |"j9                  }&dx}'x}(})t          |"j5        tt                    r5|"j;        })d}'t'          j<        |"j=                  >                                }(n.t          |j5        t~                    rtY          |j5                  }'t          |"          \  }*}+ ||#|!t          |          |$||%|&|)|'|(|+|*          },|,                     |	           |                    |,           |dz  }1d |D             }- t          |           | jA        | j        | j        | j        ||
||-|	|
  
        }.t          | d          r| jC        |._C        |.D                    |           |r|r|.E                    |            |.S )a0  
        Create and return the axes.

        Parameters
        ----------
        axes: list or None
            The names or numbers of the axes to create.
        obj : DataFrame
            The object to create axes on.
        validate: bool, default True
            Whether to validate the obj against an existing object already written.
        nan_rep :
            A value to use for string column nan_rep.
        data_columns : List[str], True, or None, default None
            Specify the columns that we want to create to allow indexing on.

            * True : Use all available columns.
            * None : Use no columns.
            * List[str] : Use the specified columns.

        min_itemsize: Dict[str, int] or None, default None
            The min itemsize for a column in bytes.
        z/cannot properly create the storer for: [group->r  rY  Nr   c                :    g | ]}                     |          S r   )_get_axis_number)rn   r   r  s     r_   rq   z&Table._create_axes.<locals>.<listcomp>  s'    666A$$Q''666ra   Tc                    g | ]	}|j         
S r   r  r  s     r_   rq   z&Table._create_axes.<locals>.<listcomp>  s    444qAF444ra   Fr3  rk   z<currently only support ndim-1 indexers in an AppendableTableri  c              3  $   K   | ]
}|v|V  d S r\   r   )rn   r\  r  s     r_   r  z%Table._create_axes.<locals>.<genexpr>  s'      66166ra   r0  r  r  r   rX  r"  zIncompatible appended table [z]with existing table [values_block_)existing_colr   r   rW   r   r   r)  r  )re   r+  r  r-  r.  r  r)  r  r   r/  r]  r  c                *    g | ]}|j         	|j        S r   )r'  re   )rn   r|  s     r_   rq   z&Table._create_axes.<locals>.<listcomp>  s"    BBBCC,ABsxBBBra   )
r   r   rW   r   r  r_  r  r   r  r   r  )Frc   r-   r   r   r   r   rG  r  rr   r   r   r  r  rt   r   r  r  r_  r,   rc  r?   r  r  r  r   r   _get_axis_namer  rW   r   rd  r0  r  r  _reindex_axisrt  rn  rf  _get_blocks_and_itemsr  r  rl  r  r   rZ   
IndexErrorr   _maybe_convert_for_string_atomr  rU  r4  r  r  r]  re   r  r  r)  r(   r  r  r	  r  r4   r  r   rQ  r  rR  r
  )/r   r  r  r
  r   r   r   r   table_existsnew_infonew_non_index_axesr  r   append_axisindexer
exist_axisr  	axis_name	new_indexnew_index_axesjr  r  r  r  vaxesr  r  b_itemsrV  re   r{  r  new_namedata_convertedrW  r-  r  r)  r   r/  r  r  r  r|  dcs	new_tables/    ``                                            r_   _create_axeszTable._create_axes  s?   @ #y)) 	J&E'% ' 's))' ' '   <3D 7666666 ?? 	!L44DO444D 122LlGG !L9yA~~~~t99	A%%N  
 $& ?G 6666f66666HSM1gg 	-,--G,W5a8J#%%$$ 	   - $HVK0011HVJ//00# $	   - #-K ""3++QWWAww'V!!3"4555 1gHSM&&s++	"9aLL		 	!h'''  ...#Avvvv %&&!++++# 	1 	1AQqT1Q400CC^q(
 11,(:
 
 Z00==?? 66<!3T5E|
 
	
 !*3vy+N+N+N!O!O K	 K	A~WED  VG 1 1gajL6P6P(qz
4(=(=$%TUUU  	$ 	$#'#3A#6LL"H-   $D D D040@D D D    $22q22H;
)){	 	 	N *(DLAAH//.11C!."6";<<DB~tT22>^.//(,,D,8g..0@AA &(0!:n&?@@FFHHCI{33 &39~~7GGD*%G}}!   C OOH%%%LLFAABB5BBBDJJ;*];%-
 
 
	 4"" 	+#{I''555 	% 	%t$$$s   7PP7P22P7r  r  c                   d }| j         }t          |j                  } ||          }t          |          r|d         \  }	}
t	          |
                              t	          |                    }|                     ||	          j         }t          |j                  } ||          }|D ]W}|                     |g|	          j         }|                    |j                   |                     ||                     X|rd t          ||d          D             }g }g }|D ]}t          |j
                  }	 |                    |          \  }}|                    |           |                    |           Z# t          t          f$ r8}d                    d |D                       }t!          d	| d
          |d }~ww xY w|}|}||fS )Nc                *      fd j         D             S )Nc                N    g | ]!}j                             |j                  "S r   )r)  r  r  )rn   r  mgrs     r_   rq   zFTable._get_blocks_and_items.<locals>.get_blk_items.<locals>.<listcomp>  s)    GGGSCINN3<00GGGra   )r  )r  s   `r_   get_blk_itemsz2Table._get_blocks_and_items.<locals>.get_blk_items  s    GGGGCJGGGGra   r   r  c                \    i | ])\  }}t          |                                          ||f*S r   )rs   tolist)rn   br  s      r_   r  z/Table._get_blocks_and_items.<locals>.<dictcomp>  sD       Aw gnn&&''!W  ra   TrX  r:  c                ,    g | ]}t          |          S r   rB  )rn   items     r_   rq   z/Table._get_blocks_and_items.<locals>.<listcomp>  s     &L&L&Ld|D'9'9&L&L&Lra   z+cannot match existing table structure for [z] on appending data)r  rr   r  rt   r/   r  r  r  rl  rs   r  ro  r   r  r   r@  r   )r  r  r  r  r   r  r  r  r  rd  rs  
new_labelsr  by_items
new_blocksnew_blk_itemsear)  r  r  r  jitemss                         r_   r  zTable._get_blocks_and_items  sC   	H 	H 	H j"3:..!.s!3!3	| 	5
 !31 5D+{++66u\7J7JKKJ--
-66;C#*%%F%c**I! 5 5 mmQCdm338cj)))  s!3!34444  	& "%fi"E"E"E  H ')JM!  bi((	!)e!4!4JAw%%a(((!((1111"H-    XX&L&Le&L&L&LMMF$,f , , ,    F%Iy  s   AFG3G

Gri  rh  c                p    |t          |          }|G j        r@t           j        t                     sJ  j        D ]}||vr|                    d|            j        D ]\  }}t          |||           fd}|j        -|j                                        D ]\  }}	}
 |||
|	          S )zprocess axes filtersNr   c                L   j         D ]}                    |          }                    |          }|J | |k    rX	j        r'|                    t          	j                            } |||          }                    |          |         c S | |v rut          t          |           j
                  }t          |          }t          t                    rd|z
  } |||          }                    |          |         c S 
t          d|  d          )Nr  rk   zcannot find the field [z] for filtering!)_AXIS_ORDERSrw  	_get_axisr  unionr/   r  r  rA   r  r  rc   r-   r   )
fieldfiltopr  axis_numberaxis_valuestakersr  r  r   s
           r_   process_filterz*Table.process_axes.<locals>.process_filter
  sO   !$!1 A AI"%"6"6y"A"AK"%--	":":K&222 	))  . B#'::eDK.@.@#A#AD!#K!6!6"wwKw88@@@@ +--!-gc5.A.A.H!I!I+D11 &c955 :*+k/K!#FD!1!1"wwKw88@@@@ . !!R5!R!R!RSSSra   )	rr   r  rc   r  insertr_  r~  filterr   )r   r  ri  r   r  rd  labelsr  r  r  r  s   ``         r_   process_axeszTable.process_axes  s    7mmG 4#6dk400000[ ) )G##NN1a((( !/  	T  	TLD&T67;;CT T T T T T T@ '#,#3#:#:#<#< 6 6r4$nUD"55
ra   r   r   r  c                   |t          | j        d          }d|d}d | j        D             |d<   |r<|	| j        pd}t	                                          |||p| j                  }||d	<   n| j        
| j        |d	<   |S )
z:create the description of the table from the axes & valuesNi'  r{   )re   r  c                (    i | ]}|j         |j        S r   )r+  r-  r  s     r_   r  z,Table.create_description.<locals>.<dictcomp>?  s    >>>qAGQU>>>ra   ry  	   )r   r   r   r   )maxr  r  r   r   r,  r   r   )r   r   r   r   r  r  r   s          r_   create_descriptionzTable.create_description0  s     t2E::Ll;; ?>DI>>>- 
	)  O0q	ii''#%9)9 (  G
 #AiLL]&=AiLra   c                   |                      |           |                                 sdS t          | |||          }|                                }|j        |j                                        D ]|\  }}}|                     ||                                |                                dz             }	| ||	j	        ||                                z
           |          j
                 }}t          |d          S )zf
        select coordinates (row numbers) from a table; return the
        coordinates object
        FrL  Nrk   r  r  )rc  rG  rh  select_coordsr  r   rS  r  r  ilocr  r/   )
r   ru   r   r   ri  coordsr  r  r  r  s
             r_   rN  zTable.read_coordinatesO  s    	e$$$    	5 d%u4HHH	((**'#,#3#:#:#<#< S Sr4''FJJLL14D (    49Vfjjll-B#CT J J QRV%((((ra   rQ  c                :   |                                   |                                 sdS |t          d          | j        D ]}||j        k    r|j        st          d| d          t          | j        j	        |          }|
                    | j                   |                    |||         | j        | j        | j                  }|d         }t          | j        j        | dd          }	t#          ||d|		          c S t%          d| d
          )zj
        return a single column from the table, generally only indexables
        are interesting
        FNz4read_column does not currently accept a where clausezcolumn [z=] can not be extracted individually; it is not data indexabler  rk   r  )re   r  r]  z] not found in the table)rc  rG  r   r  re   r'  r   r  r{   r  r  r  rp  r   rW   r   ru  r3   r   )
r   rQ  ru   r   r   r   r  
col_valuescvsr]  s
             r_   rS  zTable.read_columni  s\    	    	5RSSS  	I 	IA* $36 3 3 3   DJOV44

49%%%YYeDjM L!];	 '  
 !m
 0V2B2B2BDIIcU%HHHHHH%  ( B&BBBCCCra   )Nr   NNNNNN)r   r   r   rM   rW   rX   r   rZ   r  r  r_  r  r  r  r   r  r  r  rY   r   r  )r  rZ   r  r  )r  r   rY   r  r  )rY   r"  )rY   r)  )rY   r.  )rY   r:  )rY   r  )r   rZ   rY   rZ   )r   rZ   r  rR  rY   r   r  r\   r  )r  rX   rY   r   r  )r   r   r   r   rY   rf  r  r   r  )TNNN)r  r-   r
  r   )r  r-   r  r   )ri  rh  rY   r-   )r   r   r   r   r  r   rY   r.  r   r   r   r   )rQ  rZ   r   r   r   r   )4r   r  r  r  r,  r-  r  r  rm  r   r  r  r	  r   r
  r  r  r  r  r[  r{   r]  ry  r  r  r(  r-  r9  r>  rA  rC  r  r  rU  rX  rc  rR  r   rM  r  rk  r  rn  rt  r  staticmethodr  r  r  rN  rS  r  r  s   @r_   r  r    s         . KKOOO#$F$$$$HNNN  $,0;?,0$(       * - - - X-
 
 
 
$   % % % %N - - - X-! ! ! !" F F F XF % % % X% 2 2 X2   X     X  & & X& B B B XB < < < X<    X 
 
 
 X
" " " "< < < <
3 3 3 3* * * *

 
 
 
$   $ $ $ $
Q 
Q 
Q 
Q	 	 	 	 	   * I I ^IX ?CT T T T Tn CG         D    [$= $= $= $=T p p p p pd 9! 9! 9! \9!v5 5 5 5 5n   @ HL) ) ) ) ):  +D +D +D +D +D +D +D +D +Dra   r  c                  0    e Zd ZdZdZ	 	 	 	 dddZdd
ZdS )r  z
    a write-once read-many table: this format DOES NOT ALLOW appending to a
    table. writing is a one-time operation the data are stored in a format
    that allows for searching the data on disk
    r  Nr   r   r   c                     t          d          )z[
        read the indices and the indexing array, calculate offset rows and return
        z!WORMTable needs to implement readrg  rh  s        r_   r>  zWORMTable.read  s     ""EFFFra   rY   r   c                     t          d          )z
        write in a format that we can search later on (but cannot append
        to): write out the indices and the values using _write_array
        (e.g. a CArray) create an indexing table so that we can search
        z"WORMTable needs to implement writerg  rj  s      r_   r   zWORMTable.write  s     ""FGGGra   rl  r  r  )r   r  r  r  r  r>  r   r   ra   r_   r  r    sk          J  
G 
G 
G 
G 
GH H H H H Hra   r  c                  V    e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 dddZdddZddZ	 d d!dZdS )"r  (support the new appendable table formats
appendableNFTr   r   r   r   r   rs  rY   r   c                   |s'| j         r | j                            | j        d           |                     ||||||          }|j        D ]}|                                 |j         sJ|                    ||||	          }|                                 ||d<    |j        j	        |j        fi | |j
        |j        _
        |j        D ]}|                    ||           |                    ||
           d S )Nr{   )r  r  r
  r   r   r   )r   r   r   r  rs  )r   )r  r   r  r   r  r  r  r  rU  create_tabler  ru  r  
write_data)r   r  r  r   r   r   r   r   r   r  r   r   r   rs  r{   r   optionss                    r_   r   zAppendableTable.write  sM      	:$. 	:L$$TZ999 !!%% " 
 
  	 	A 	?..#%)	 /  G OO%0GM" 'EM&u{>>g>>> !:  	. 	.Auf---- 	622222ra   c                4   | j         j        }| j        }g }|rv| j        D ]n}t	          |j                                      d          }t          |t          j	                  r*|
                    |                    dd                     o|r/|d         }|dd         D ]}||z  }|                                }nd}d | j        D             }	t          |	          }
|
dk    s
J |
            d	 | j        D             }d
 |D             }g }t          |          D ]L\  }}|g| j         ||
|z                     j        R }|
                    |                    |                     M|d}t          j        t'          ||          | j                   }||z  dz   }t)          |          D ]e}||z  t'          |dz   |z  |          k    r dS |                     |fd|	D             |
|         ndfd|D                        fdS )z`
        we form the data into a 2-d including indexes,values,mask write chunk-by-chunk
        r   r  u1Fr  rk   Nc                    g | ]	}|j         
S r   )r  r  s     r_   rq   z.AppendableTable.write_data.<locals>.<listcomp>  s    66619666ra   c                6    g | ]}|                                 S r   )rs  r  s     r_   rq   z.AppendableTable.write_data.<locals>.<listcomp>  s     :::A!++--:::ra   c           	         g | ]I}|                     t          j        t          j        |j                  |j        d z
                      JS r  )	transposerc  rollaranger  r  s     r_   rq   z.AppendableTable.write_data.<locals>.<listcomp>  sB    VVV!!++bgbi&7&7!DDEEVVVra   r  r   c                $    g | ]}|         S r   r   )rn   r   end_istart_is     r_   rq   z.AppendableTable.write_data.<locals>.<listcomp>,  s"    ;;;a75=);;;ra   c                $    g | ]}|         S r   r   )rn   r  r  r  s     r_   rq   z.AppendableTable.write_data.<locals>.<listcomp>.  s"    :::Q'%-(:::ra   )indexesr  r  )r]  r  r  r  r7   r  r  rc   rc  rd  r   r  r  r  rt   r  r  reshaper  r  r  write_data_chunk)r   r   r   r  rE  masksr   r  r  r  nindexesr  bvaluesr  r  	new_shaperowschunksr  r  s                     @@r_   r  zAppendableTable.write_data  s    
 #  	@% @ @ AF||''Q'//dBJ// @LLT!>!>???  	8D122Y    ax::<<DDD 76do666w<<1}}}h}}} ;:)9:::VVvVVVf%% 	1 	1DAqGE(Q,,?!@!FGGINN199Y//0000 IxIu--TZ@@@)#a'v 	 	A)mGQ)+U33E%!!;;;;;7;;;,0,<T'%-(($:::::':::	 "    	 	ra   r  rR  r  list[np.ndarray]r  npt.NDArray[np.bool_] | Noner  c                   |D ]}t          j        |j                  s dS |d         j        d         }|t          |          k    rt          j        || j                  }| j        j        }t          |          }t          |          D ]\  }	}
|
|||	         <   t          |          D ]\  }	}||||	|z            <   |K|                                	                    t          d           }|                                s||         }t          |          r5| j                            |           | j                                         dS dS )z
        Parameters
        ----------
        rows : an empty memory space where we are putting the chunk
        indexes : an array of the indexes
        mask : an array of the masks
        values : an array of the values
        Nr   r   Fr  )rc  r  r  rt   r  r]  r  r  r  r  r   r  r{   r   r4  )r   r  r  r  r  r  rE  r  r  r  r  r  s               r_   r  z AppendableTable.write_data_chunk1  sm      	 	A717##  
 #CII8E444D
 w<<  (( 	! 	!FAs DqNN f%% 	* 	*DAq()Dq8|$%% $$T$666A5577 Awt99 	Jd###J	 	ra   r   r   c                (   |t          |          sm|+|)| j        }| j                            | j        d           n>|| j        }| j                            ||          }| j                                         |S |                                 sd S | j        }t          | |||          }|
                                }t          |d                                          }t          |          }	|	r|                                }
t          |
|
dk             j                  }|sdg}|d         |	k    r|                    |	           |d         dk    r|                    dd           |                                }t'          |          D ]c}|                    t+          ||                    }|                    ||j        d                  ||j        d                  dz              |}d| j                                         |	S )	NTry  r  Fr  rk   r   r  )rt   rE  r   r  r   r{   remove_rowsr4  rG  rh  r  r3   sort_valuesdiffrr   r   r   r  ro  reversedr  r  )r   ru   r   r   rE  r{   ri  r  sorted_serieslnr  r   pgr(  r  s                  r_   r  zAppendableTable.delete]  s$    =E

=}
((t(DDDD <:D
..U.FF
  """L    	4 
dETBBB	((** vE222>>@@ 	 %%''D$tax..//F   bzRb!!! ayA~~a### Bf%%  $))%2,,77!!tz!}-DB4H14L "    J 	ra   )NFNNNNNNFNNT)
r   r   r   r   r   r   rs  r   rY   r   r  )r   r   r   r   rY   r   )
r  rR  r  r  r  r  r  r  rY   r   r  rm  )	r   r  r  r  r  r   r  r  r  r   ra   r_   r  r    s        22J  $ 93 93 93 93 93v9 9 9 9 9v* * * *Z HL: : : : : : :ra   r  c                  p    e Zd ZU dZdZdZdZeZde	d<   e
dd	            Zedd            Z	 	 	 	 dddZdS )r  r  r  r  r3  r.  r/  rY   r   c                .    | j         d         j        dk    S )Nr   rk   )r  rd  r   s    r_   r(  z"AppendableFrameTable.is_transposed  s    q!&!++ra   r  c                    |r|j         }|S )zthese are written transposed)r  rm  s      r_   rn  zAppendableFrameTable.get_object  s      	%C
ra   Nr   r   r   c                <                          |                                            sd S                      |||          }t           j                  r, j                             j        d         d         i           ni } fdt           j                  D             }t          |          dk    sJ |d         }||         d         }	g }
t           j                  D ]\  }}| j	        vr||         \  }}|                    d          dk    rt          |          }nt          j        |          }|                    d          }||                    |d	            j        r%|}|}t          |	t          |	d
d                     }n)|j        }t          |	t          |	d
d                     }|}|j        dk    r<t%          |t&          j                  r"|                    d|j        d         f          }t%          |t&          j        t.          f          r	 t1          |j        ||d          }n# t2          $ r} j        dk    rjt7                      r\t9          |                              d          r:t<          r3t1          |j        ||dt?          dt&          j                             }n Y d }~nHd }~ww xY wt%          |t                    rt1          |||          }nt1          j!        |g||          }t7                      r|j"        j#        dk    s8|j$        |j"        k    %                                sJ |j$        |j"        f            |D ]B}t           j&        j'        | dd           }|dv r||         (                    |          ||<   C|
)                    |           t          |
          dk    r	|
d         }ntU          |
d          }tW           |||          } ,                    |||          }|S )NrL  r   c                8    g | ]\  }}|j         d          u |S r^  r=  )rn   r  r  r   s      r_   rq   z-AppendableFrameTable.read.<locals>.<listcomp>  s.    PPPearT_Q=O7O7O7O7O7Ora   rk   r   r0   r  Tinplacere   rd   Fr  r[  r\  r^  r_  )r   r   r  r]  r  r  r  )rZ   r  r  )ri  r   )-rc  rG  rk  rt   r_  r  r   r  r  r  r/   r0   from_tuples	set_namesr(  r  r  r  rc   rc  rd  r  r  r9   r-   rh  r   r   rZ   r  r   r4   ri  _from_arraysr]  r  dtypesr  r{   ru  r  r   r6   rh  r  )r   ru   r   r   r   r  r  indsindr   framesr  r   
index_valsr  r  r  r  index_cols_r  r  rQ  r]  ri  s   `                        r_   r>  zAppendableFrameTable.read  sb    	e$$$    	4uEEE 4&''DIMM$-a03R888 	 QPPPy33PPP4yyA~~~~1gsAdi(( =	 =	DAq((("()J xx<//Z((!-j99HHW%%E ud333!  e'%*F*FGGG u75&$+G+GHHH {aJvrz$B$BFLO(<==&2:}"=>> S"68U&uUUUBB)   66.00 7HH--.FGG 7 ( 7
 '"H$)"(!&"-h"P"P"P      FE** SvuFCCC +VHe6RRR&(( TV\->#-E-E	V\16688SS29fl:SSSS   : :
 0V2B2B2BDII---!#F!2!25!9!9BvJMM"v;;!BBQ'''Bd%u4HHH	rYHH	s   ,I
KA6K

Kr  r  rl  r  )r   r  r  r  r,  r  r  r-   r/  r  r  r(  r  rn  r>  r   ra   r_   r  r    s         22K#JD)2H2222, , , X,    [  d d d d d d dra   r  c                  |     e Zd ZdZdZdZdZeZe	dd            Z
edd	            Zdd fdZ	 	 	 	 dd fdZ xZS )r  r  r  r  r3  rY   r   c                    dS r  r   r   s    r_   r(  z#AppendableSeriesTable.is_transposed  r  ra   r  c                    |S r\   r   rm  s      r_   rn  z AppendableSeriesTable.get_object   s    
ra   Nr   c                    t          |t                    s|j        pd}|                    |          } t	                      j        d||j                                        d| dS )+we are going to write this as a frame tabler  r  r   Nr   )rc   r-   re   to_framer  r   r   r  )r   r  r   r   re   r  s        r_   r   zAppendableSeriesTable.write%  si    #y)) 	%8'xD,,t$$CK#CK,>,>,@,@KKFKKKKKra   r   r   r   r3   c                j   | j         }|B|r@t          | j        t                    sJ | j        D ]}||vr|                    d|           t                                          ||||          }|r|                    | j        d           |j        d d df         }|j	        dk    rd |_	        |S )Nr   rc  Tr  r  )
r  rc   r  rr   r  r  r>  	set_indexr  re   )	r   ru   r   r   r   r  r  rB  r  s	           r_   r>  zAppendableSeriesTable.read,  s     ,>dk400000[ ) )G##NN1a(((GGLLugULNN 	3KKTK222F111a4L 6XAFra   r  r  r\   r  rl  r  )r   r  r  r  r,  r  r  r3   r/  r  r(  r  rn  r   r>  r  r  s   @r_   r  r    s        22 K$JDH   X    [L L L L L L L            ra   r  c                  ,     e Zd ZdZdZdZd fdZ xZS )r  r  r  r  rY   r   c                <   |j         pd}|                     |          \  }| _        t          | j        t                    sJ t	          | j                  }|                    |           t          |          |_         t                      j	        dd|i| dS )r  r  r  Nr   )
re   r  r  rc   rr   r   r/   r   r  r   )r   r  r   re   newobjr  r  s         r_   r   z AppendableMultiSeriesTable.writeL  s    x#8"66s;;$+t,,,,,DK  Dt++&+F+++++ra   r  )r   r  r  r  r,  r  r   r  r  s   @r_   r  r  E  sM        22 K)J, , , , , , , , , ,ra   r  c                      e Zd ZU dZdZdZdZeZde	d<   e
dd	            Ze
d
             ZddZed             ZddZdS )r  z:a table that read/writes the generic pytables table formatr  r  r3  zlist[Hashable]r  rY   rZ   c                    | j         S r\   )r,  r   s    r_   r  zGenericTable.pandas_type`  s    ra   c                <    t          | j        dd           p| j        S r  r  r   s    r_   r[  zGenericTable.storabled  s    tz7D11?TZ?ra   r   c                    g | _         d| _        g | _        d | j        D             | _        d | j        D             | _        d | j        D             | _        dS )r  Nc                     g | ]}|j         	|S r   rI  r  s     r_   rq   z*GenericTable.get_attrs.<locals>.<listcomp>n  rJ  ra   c                     g | ]}|j         	|S r   rI  r  s     r_   rq   z*GenericTable.get_attrs.<locals>.<listcomp>o  rL  ra   c                    g | ]	}|j         
S r   rd   r  s     r_   rq   z*GenericTable.get_attrs.<locals>.<listcomp>p  s    >>>QV>>>ra   )r_  r   r  rM  r  r  r   r   s    r_   rX  zGenericTable.get_attrsh  sf     KKdoKKKPPtPPP>>T-=>>>ra   c           
        | j         }|                     d          }|dnd}t          dd| j        ||          }|g}t	          |j                  D ]x\  }}t          |t                    sJ t          ||          }|                     |          }|dnd}t          |||g|| j        ||          }	|
                    |	           y|S )z0create the indexables from the table descriptionr   Nr  r   )re   rd  r{   r   r/  )re   r.  r  r-  r{   r   r/  )ry  r  r  r{   r  _v_namesrc   rZ   r  r)  r   )
r   r  rX  r   r^  r]  r  r  r  r  s
             r_   rM  zGenericTable.indexablesr  s    
 ((^zz#q

 
 
	 IR{aj)) 	# 	#DAqa%%%%%1a==D##A&&B!#::TD(sj  B r""""ra   c                     t          d          )Nzcannot write on a generic tablerg  )r   r   s     r_   r   zGenericTable.write  s    !"CDDDra   Nr  r  )r   r  r  r  r,  r  r  r-   r/  r  r  r  r[  rX  r   rM  r   r   ra   r_   r  r  W  s         DDK JDH      X  @ @ X@? ? ? ?     ^ FE E E E E Era   r  c                       e Zd ZdZdZeZdZ ej	        d          Z
edd            Zdd fd
Z	 	 	 	 dd fdZ xZS )r  za frame with a multi-indexr  r3  z^level_\d+$rY   rZ   c                    dS )Nappendable_multir   r   s    r_   r  z*AppendableMultiFrameTable.table_type_short  s    !!ra   Nr   c                >   |g }n|du r|j                                         }|                     |          \  }| _        t	          | j        t
                    sJ | j        D ]}||vr|                    d|            t                      j        d||d| d S )NTr   r  r   )	r   r  r  r  rc   rr   r  r  r   )r   r  r   r   r  r  s        r_   r   zAppendableMultiFrameTable.write  s    LLT!!;--//L33C88T[$+t,,,,, 	* 	*A$$##Aq)))C#LCCFCCCCCra   r   r   r   r-   c                     t                                          ||||          }|                     j                  }|j                             fd|j        j        D                       |_        |S )Nrc  c                L    g | ] }j                             |          rd n|!S r\   )
_re_levelssearch)rn   re   r   s     r_   rq   z2AppendableMultiFrameTable.read.<locals>.<listcomp>  s2    WWWT_++D11;TTtWWWra   )r  r>  r  r  r   r  r  )r   ru   r   r   r   r  r  s   `     r_   r>  zAppendableMultiFrameTable.read  ss     WW\\we$\OO\\$+&& 8%%WWWWWWW
 
 	ra   r  r\   r  rl  r  )r   r  r  r  r  r-   r/  r  recompiler  r  r  r   r>  r  r  s   @r_   r  r    s        $$(JHDN++J" " " X"
D 
D 
D 
D 
D 
D 
D            ra   r  r  r-   rd  rP   r  r/   c                   |                      |          }t          |          }|t          |          }||                    |          r|                    |          r| S t          |                                          }|6t          |                                                              |d          }|                    |          s8t          d d           g| j        z  }|||<   | j        t          |                   } | S )NF)sort)	r  rA   equalsuniquer  slicer  r  rs   )r  rd  r  rC  r  slicers         r_   r~  r~    s     
t		B&!!F U##u--6==3D3D
&--//**Fellnn--::6:NN== %',T4'8'8&9CH&DtgeFmm$Jra   r)  r   str | tzinfoc                .    t          j        |           }|S )z+for a tz-aware type, return an encoded zone)r   get_timezone)r)  zones     r_   r  r    s    !"%%DKra   r  npt.NDArray[np.int64]str | tzinfo | Nonedatetime64_dtyper9   c                    | j         dk    sJ | j                     t          j        |          \  }}t          d|          }t	          ||          }t          j        | |          }|S )z
    Coerce the values to a DatetimeArray with appropriate tz.

    Parameters
    ----------
    values : ndarray[int64]
    tz : str, tzinfo, or None
    datetime64_dtype : str, e.g. "datetime64[ns]", "datetime64[25s]"
    rV  rS   )r)  r  r   )r]  rc  datetime_datar   r;   r9   _from_sequence)r  r)  r)  r  r  r]  r  s          r_   r  r    su     <4 /00GD!
D!!D 2D)))E

&vU
;
;
;CJra   re   c                   t          | t                    sJ |j        }t          |          \  }}t	          |          }t
                              |          }t          j        |j	        d          s(t          |j	                  st          |j	                  r4t          | |||t          |dd           t          |dd           |          S t          |t                    rt          d          t          j        |d          }	t#          j        |          }
|	dk    r\t#          j        d	 |
D             t"          j        
          }t          | |dt)                                                      |          S |	dk    rPt-          |
||          }|j	        j        }t          | |dt)                                          |          |          S |	dv rt          | ||||          S t          |t"          j                  r|j	        t4          k    sJ |dk    s
J |            t)                                                      }t          | ||||          S )Niur(  r)  )r  r  r-  r(  r)  r*  zMultiIndex not supported here!Fr  r   c                6    g | ]}|                                 S r   )	toordinalr  s     r_   rq   z"_convert_index.<locals>.<listcomp>#  s     >>>!>>>ra   r   )r*  r  )integerfloating)r  r  r-  r*  rD  )rc   rZ   re   r  r  r   r  r   rg  r]  r'   r#   r%  r  r0   r   r  rc  r  int32r   	Time32Col_convert_string_arrayr2  r  rd  rD  r  )re   r   rW   r   r*  r  r  r  r  r  r  r2  s               r_   r  r    s~   dC     J 5U;;Iz*%%D%%i00D 	T**
u{++
 %%
 --udD))!
 
 
 	
 %$$ :8999OE%888M ZFJ>>v>>>bhOOO	)VWYY%8%8%:%:z
 
 
 	
 
(	"	")&(FCC	?+II))!
 
 
 	
 
1	1	14J
 
 
 	
 )RZ00NY_5N5N5N5Nxyy##%%it
KKKKra   r  np.ndarray | Indexc                   |                     d          r?|dk    rt          | d          }n>t          |                     |          d          }n|                     d          r=|dk    rt          | d          }nt          |                     |          d          }n|dk    r\	 t	          j        d | D             t                    }n# t          $ r( t	          j        d | D             t                    }Y nhw xY w|d	v rt	          j        |           }nK|d
v rt          | d ||          }n3|dk    rt	          j        | d                   }nt          d|           |S )Nr  Fr  r  r   c                6    g | ]}t          j        |          S r   r  r  s     r_   rq   z$_unconvert_index.<locals>.<listcomp>N  s#    BBB 0 3 3BBBra   r   c                6    g | ]}t          j        |          S r   r  r  s     r_   rq   z$_unconvert_index.<locals>.<listcomp>P  s#    DDD! 21 5 5DDDra   )r1  floatr   r  r  rD  r   zunrecognized index type )	r  r.   r  r5   rc  r  rD  r   r  )r  r  rW   r   r   s        r_   r  r  =  s    |$$ <<!$U333EE!$))D//>>>EE		'	' <=  "4e444EE"499T?????EE		TJBBTBBB&QQQEE 	T 	T 	TJDDtDDDFSSSEEE	T	-	-	-
4  	(		'$&
 
 
 
		
47##:D::;;;Ls   .%C /DDr  rO   r  c                   t          |j        t                    r|                                }|j        t          k    r|S t          t          j        |          }|j        j        }t          j
        |d          }	|	dk    rt          d          |	dk    rt          d          |	dk    s|dk    s|S t          |          }
|                                }|||
<   |r;|
                                r't          |          |j        k    rt#          d	          t          j
        |d          }	|	dk    rwt%          |j        d
                   D ]\}||         }t          j
        |d          }	|	dk    r6t          |          |k    r||         nd| }t          d| d|	 d          ]t)          |||                              |j                  }|j        }t          |t,                    r9t/          |                    |           p|                    d          pd
          }t3          |pd
|          }||                    |          }|||k    r|}|                    d| d          }|S )NFr  r   z+[date] is not implemented as a table columnrp  z>too many timezones in this block, create separate data columnsr  rD  z8NaN representation is too large for existing column sizer   zNo.r	  z2]
because its data contents are not [string] but [r
  r  z|Sr  )rc   r]  r4   r  rD  r   rc  rd  re   r   r  r   r7   r  r  rt   r2  r   r  r  r5  r  r  ri   r   r  r  r  )re   r  r{  r   r   rW   r   r   r  r  r  r  r  r|  error_column_labelr  r2  ecis                     r_   r  r  ^  s    '--- %""$$}2:w''G#JOGE:::MEFFF
"" L
 
 	
 X%%x)?)?==D<<>>DDJ U

 Us7||l6K'K'KSTTT OD777M   tz!}%% 		 		Aq'COC>>>M((36w<<!3C3CWQZZq"64F 6 6%6 6 6   ) +46BBJJ4:VVN&H ,%% V<++D11T\5E5Eh5O5OTSTUU<$1h//H ''11?sX~~H#**???*GGNra   r  rR  c                   t          |           rZt          |                                 dd          j                            ||          j                            | j                  } t          |                                           }t          dt          j        |                    }t          j        | d|           } | S )a  
    Take a string-like that is object dtype and coerce to a fixed size string type.

    Parameters
    ----------
    data : np.ndarray[object]
    encoding : str
    errors : str
        Handler for encoding errors.

    Returns
    -------
    np.ndarray[fixed-length-string]
    FrD  )r  r]  rk   Sr   )rt   r3   r  rZ   encoder  r  r  r"   r  
libwritersmax_len_string_arrayrc  r  )r  rW   r   ensuredr2  s        r_   r5  r5    s      4yy 
4::<<e8<<<&))WWTZ(( 	 DJJLL))G1j5g>>??H:d.h..111DKra   c                b   | j         }t          j        |                                 t                    } t          |           rt          j        t          |                     }d| }t          | d         t                    rMt          | d          j                            ||d          }|                                } d| j        _        n1|                     |d                              t          d          } |d
}t          j        | |           |                     |          S )a*  
    Inverse of _convert_string_array.

    Parameters
    ----------
    data : np.ndarray[fixed-length-string]
    nan_rep : the storage repr of NaN
    encoding : str
    errors : str
        Handler for encoding errors.

    Returns
    -------
    np.ndarray[object]
        Decoded data.
    r   Ur   Fr  rD  )r   r]  TNri  )r  rc  r  r  rD  rt   rA  rB  r"   rc   bytesr3   rZ   decoder  flags	writeabler  !string_array_replace_from_nan_repr  )r  r   rW   r   r  r2  r]  sers           r_   r  r    s   & JE:djjll&111D
4yy M2=3F3FGGHd1gu%% 	ME***.55x 6  C <<>>D#'DJ  ;;u5;1188e8LLD0w???<<ra   rl  c                    t          |t                    sJ t          |                      t          |          rt	          |||          } ||           } | S r\   )rc   rZ   r   _need_convert_get_converter)r  rl  rW   r   convs        r_   rf  rf    sY    h$$44d8nn444X h&99fMra   c                h      dk    rd S d v r fdS  dk    rfdS t          d            )Nr  c                .    t          j        | d          S )NzM8[ns]r   rc  r  )r\  s    r_   r   z _get_converter.<locals>.<lambda>  s    AX666 ra   c                0    t          j        |           S )Nr   rR  )r\  r  s    r_   r   z _get_converter.<locals>.<lambda>  s    AT222 ra   r  c                *    t          | d           S )Nr  )r  )r\  rW   r   s    r_   r   z _get_converter.<locals>.<lambda>  s     0thv
 
 
 ra   zinvalid kind )r   )r  rW   r   s   ```r_   rN  rN    su    |666			22222			
 
 
 
 
 	
 ///000ra   c                    | dv sd| v rdS dS )N)r  r  r  TFr   r  s    r_   rM  rM  
  s"    '''<4+?+?t5ra   r4  Sequence[int]c                (   t          |t                    st          |          dk     rt          d          |d         dk    rN|d         dk    rB|d         dk    r6t	          j        d|           }|r|                                d         }d| } | S )	z
    Prior to 0.10.1, we named values blocks like: values_block_0 and the
    name values_0, adjust the given name if necessary.

    Parameters
    ----------
    name : str
    version : Tuple[int, int, int]

    Returns
    -------
    str
    r<  z6Version is incorrect, expected sequence of 3 integers.r   rk   r2  r3  zvalues_block_(\d+)values_)rc   rZ   rt   r   r  r  r   )re   r4  r  grps       r_   rU  rU    s     '3 S3w<<!#3#3QRRRqzQ71:++
aI+T22 	#((**Q-C"S??DKra   	dtype_strc                    |                      d          rd}n|                      d          rd}n|                      d          rd}n|                      d          rd}n|                      d          r| }n|                      d          r| }nm|                      d	          rd	}nU|                      d
          rd
}n=|                      d          rd}n%| dk    rd}n| dk    rd}nt          d|  d          |S )zA
    Find the "kind" string describing the given dtype name.
    )r  rF  r  r:  ra  )ri   r  r1  r  	timedeltar   r  r  rD  rZ   zcannot interpret dtype of [rY  )r  r   )rZ  r  s     r_   r  r  )  sV    /00 E			g	&	& E			i	(	( E			o	.	. E			l	+	+ E			k	*	* E			f	%	% E			j	)	) 
E			h	'	' E	h			e		CyCCCDDDKra   c                |   t          | t                    r| j        } t          | j        t                    rd| j        j         d}n| j        j        }| j        j        dv r(t          j	        | 
                    d                    } nt          | t                    r| j        } t          j	        |           } | |fS )zJ
    Convert the passed data into a storable form and a dtype string.
    r  rY  mMrV  )rc   r8   r  r]  r)   r  re   r  rc  r  r  r1   r  )r  r  s     r_   r  r  J  s     $$$ z$*o.. %54:?555

Z_
z$z$))D//** 
D+	&	& y:dDra   c                  f    e Zd ZdZ	 	 	 ddd
Zedd            Zedd            ZddZd Zd ZdS )rh  z
    Carries out a selection operation on a tables.Table object.

    Parameters
    ----------
    table : a Table object
    where : list of Terms (or convertible to)
    start, stop: indices to start and/or stop selection

    Nr{   r  r   r   r   rY   r   c                   || _         || _        || _        || _        d | _        d | _        d | _        d | _        t          |          r2t          t                    5  t          j        |d          }|dv rt          j        |          }|j        t          j        k    rA| j        | j        }}|d}|| j         j        }t          j        ||          |         | _        nt'          |j        j        t          j                  r^| j        || j        k                                     s$| j        ,|| j        k                                    rt          d          || _        d d d            n# 1 swxY w Y   | j        I|                     |          | _        | j        *| j                                        \  | _        | _        d S d S d S )NFr  )r1  booleanr   z3where must have index locations >= start and < stop)r{   ru   r   r   	conditionr  termsri  r%   r   r   r   r  rc  r  r]  bool_rE  r  
issubclassr   r1  r  generateevaluate)r   r{   ru   r   r   inferreds         r_   r   zSelection.__init__o  s     


	
 	1*%% 1 1?5???555Ju--E{bh..&*j$)t =$%E<#':#3D+-9UD+A+A%+H((#EK$4bjAA 1 J2
8J7O7O7Q7Q2 I1u	7I6N6N6P6P1", U# #  ,1(%1 1 1 1 1 1 1 1 1 1 1 1 1 1 1( #u--DJ z%.2j.A.A.C.C+ $# &%s   DE00E47E4ru   dict | list | tuple | strr=   c                    d S r\   r   rb  s     r_   rf  zSelection.generate  s    JM#ra   c                    d S r\   r   rb  s     r_   rf  zSelection.generate  s    -0Sra    dict | list | tuple | str | NonePyTablesExpr | Nonec                4   |dS | j                                         }	 t          ||| j         j                  S # t          $ rR}d                    |                                          }t          d| d| d          }t          |          |d}~ww xY w)z'where can be a : dict,list,tuple,stringN)r9  rW   r:  z-                The passed where expression: a*  
                            contains an invalid variable reference
                            all of the variable references must be a reference to
                            an axis (e.g. 'index' or 'columns'), or a data_column
                            The currently defined references are: z
                )	r{   r9  r=   rW   	NameErrorr@  r!  r   r   )r   ru   rQ  r  qkeysr.  s         r_   rf  zSelection.generate  s    =4J!!##	+!dj>QRRRR 	+ 	+ 	+ HHQVVXX&&E.3 
 DI   C S//s*	+s   ; 
BABBc                B   | j         C| j        j                            | j                                         | j        | j                  S | j        $| j        j                            | j                  S | j        j                            | j        | j                  S )(
        generate the selection
        Nr  )	rb  r{   
read_wherer   r   r   ri  rN  r>  r   s    r_   r   zSelection.select  s     >%:#..%%''tz	 /    ):#44T5EFFFz$$4:DI$FFFra   c                >   | j         | j        }}| j        j        }|d}n|dk     r||z  }||}n|dk     r||z  }| j        :| j        j                            | j                                        ||d          S | j        | j        S t          j	        ||          S )rr  Nr   T)r   r   r  )
r   r   r{   rE  rb  get_where_listr   ri  rc  r  )r   r   r   rE  s       r_   r  zSelection.select_coords  s     j$)t
 =EEQYYUNE<DDAXXEMD>%:#22%%''u4d 3    )##y%%%ra   r  )r{   r  r   r   r   r   rY   r   )ru   ri  rY   r=   )ru   r   rY   r   )ru   rl  rY   rm  )	r   r  r  r  r   r   rf  r   r  r   ra   r_   rh  rh  c  s        	 	  +D +D +D +D +DZ MMM XM000 X0+ + + +.
G 
G 
G& & & & &ra   rh  )rW   rX   rY   rZ   )rh   ri   )r   NNFNTNNNNr   rV   )r   r   r   rZ   r   r   r   rZ   r   r   r   rX   r   r   r   rX   r   r   r   r   r   r   r   r   r   rZ   rW   rZ   rY   r   )	Nr   r   NNNNFN)r   r   r   rZ   r   rZ   ru   r   r   r   r   r   r   r   r   r   r   r   )r   rM   r   rM   rY   r   r\   )r  r-   rd  rP   r  r/   rY   r-   )r)  r   rY   r#  )r  r'  r)  r(  r)  rZ   rY   r9   )
re   rZ   r   r/   rW   rZ   r   rZ   rY   r%  )r  rZ   rW   rZ   r   rZ   rY   r6  )re   rZ   r  rO   r   r  )r  rR  rW   rZ   r   rZ   rY   rR  )r  rR  rl  rZ   rW   rZ   r   rZ   )r  rZ   rW   rZ   r   rZ   )r  rZ   rY   r   )re   rZ   r4  rV  rY   rZ   )rZ  rZ   rY   rZ   )r  rO   )r  
__future__r   
contextlibr   r  rp  r   r   rj  r   r  textwrapr   typingr   r	   r
   r   r   r   r   r   r  numpyrc  pandas._configr   r   r   pandas._libsr   r   rA  pandas._libs.libr   pandas._libs.tslibsr   pandas.compatr   pandas.compat._optionalr   pandas.compat.pickle_compatr   pandas.errorsr   r   r   r   r   pandas.util._decoratorsr   r    pandas.util._exceptionsr!   pandas.core.dtypes.commonr"   r#   r$   r%   r&   r'   pandas.core.dtypes.dtypesr(   r)   r*   r+   pandas.core.dtypes.missingr,   r   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   pandas.core.arraysr8   r9   r:   pandas.core.arrays.datetimesr;   pandas.core.arrays.string_r<   pandas.core.commoncorecommonr~   pandas.core.computation.pytablesr=   r>   pandas.core.constructionr?   r  r@   pandas.core.indexes.apirA   pandas.io.commonrB   pandas.io.formats.printingrC   rD   collections.abcrE   rF   rG   rH   typesrI   rJ   r   rK   rL   rM   pandas._typingrN   rO   rP   rQ   rR   rS   rT   pandas.core.internalsrU   rH  r]   r`   rf   rg   r  rv   rw   rx   ry   r  r  r~   r   config_prefixregister_optionis_boolis_one_of_factoryr   r   r   r   r   r   r   rH  r%  r  r  r   r)  r+  ro  r  r  r  r  r  r  r  r  r  r  r  r~  r  r  r  r  r  r5  r  rf  rN  rM  rU  r  r  rh  r   ra   r_   <module>r     su    
 # " " " " "                   				 				      	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	                      - , , , , , ) ) ) ) ) ) % % % % % % > > > > > > 4 4 4 4 4 4                     5 4 4 4 4 4                           8 7 7 7 7 7                                  
 5 4 4 4 4 4 6 6 6 6 6 6                                 1 0 0 0 0 0 + + + + + +       
  ,                  
                           ,+++++      	 	 	     : : : :*     !     
     gGgNN 	
    
     V(##  F>5*WWWWF*&*+C+C+CDD	                  !%
 $ $ $ $$) !  4  04595 5 5 5 5p H 	# $ _ _ _ _ _D    Hq q q q q q q qh/m m m m m m m m`x> x> x> x> x> x> x> x>v	    h   :_9 _9 _9 _9 _9h _9 _9 _9D	$ $ $ $ $w $ $ $63 3 3 3 3. 3 3 3j? j? j? j? j? j? j? j?Z{B {B {B {B {B5 {B {B {B|/# /# /# /# /#, /# /# /#d[; [; [; [; [; [; [; [;|    "   
fD fD fD fD fDE fD fD fDRH H H H H H H H<b b b b be b b bJw w w w w? w w wt. . . . .0 . . .b, , , , ,!6 , , ,$@E @E @E @E @E' @E @E @EF( ( ( ( ( 4 ( ( (X 9=    4      0=L =L =L =L@   BK K K K\   >' ' ' 'T   
1 
1 
1 
1      2   B   2x& x& x& x& x& x& x& x& x& x&s   ">G,,G03G0