Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pandas/io/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pandas/io/__pycache__/pytables.cpython-312.pyc

�

MٜgW��
�D�UdZddlmZddlmZddlZddlmZmZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZmZmZmZmZmZmZddlZddlZddlmZmZmZmZdd	lmZm Z!dd
l"m#Z#ddl$m%Z%ddl&m'Z'dd
l(m)Z)ddl*m+Z+m,Z,m-Z-m.Z.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:ddl;m<Z<m=Z=m>Z>m?Z?ddl@mAZAddlBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLddlMmNZNmOZOmPZPddlQmRcmSZTddlUmVZVmWZWddlXmYZYddlZm[Z[ddl\m]Z]m^Z^ddl_m`Z`ddlambZbmcZcer4ddldmeZemfZfmgZgddlhmiZiddljmkZkmlZlmmZmddlnmoZompZpmqZqmrZrmsZsmtZtmuZumvZvdd l\mwZwd!Zxd"Zyd#�Zzdyd$�Z{d%�Z|eVZ}dzd&�Z~d'Zd(e�d)<d*Z�d(e�d+<d,Z�d(e�d-<d.d.d/d/d0�Z�eCdgiZ�d1Z�d(e�d2<d3Z�d(e�d4<e�jd5�5e�jd6d7e�e�j�8�e�jd9de�e�jgd:���8�ddd�da�d7a�d;�Z�												d{																													d|d<�Z�									d}																	d~d=�Z�dd>�Z�Gd?�d@�Z�GdA�dB�Z�GdC�dD�Z�GdE�dFe��Z�GdG�dHe��Z�GdI�dJe��Z�GdK�dLe��Z�GdM�dN�Z�GdO�dPe��Z�GdQ�dRe��Z�GdS�dTe��Z�GdU�dVe��Z�GdW�dXe��Z�GdY�dZe��Z�Gd[�d\e��Z�Gd]�d^e��Z�Gd_�d`e��Z�Gda�dbe��Z�Gdc�dde��Z�Gde�dfe��Z�	d�							d�dg�Z�d�dh�Z�e	d�							d�di��Z�ed�d�dj��Z�	d�							d�dk�Z�d�dl�Z�d�dm�Z�						d�dn�Z�d�do�Z�								d�dp�Z�d�dq�Z�d�dr�Z�d�ds�Z�d�dt�Z�d�du�Z�d�dv�Z�Gdw�dx�Z�y#1swY���xYw)�zY
High level interface to PyTables for reading and writing pandas data structures
to disk
�)�annotations)�suppressN)�date�tzinfo)�dedent)�
TYPE_CHECKING�Any�Callable�Final�Literal�cast�overload)�config�
get_option�using_copy_on_write�using_pyarrow_string_dtype)�lib�writers)�is_string_array)�	timezones)�import_optional_dependency)�patch_pickle)�AttributeConflictWarning�ClosedFileError�IncompatibilityWarning�PerformanceWarning�PossibleDataLossError)�cache_readonly)�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�TimedeltaIndex�concat�isna)�Categorical�
DatetimeArray�PeriodArray)�PyTablesExpr�maybe_expression)�
extract_array)�ensure_index)�ArrayManager�BlockManager)�stringify_path)�adjoin�pprint_thing)�Hashable�Iterator�Sequence)�
TracebackType)�Col�File�Node)�AnyArrayLike�	ArrayLike�AxisInt�DtypeArg�FilePath�Self�Shape�npt)�Blockz0.15.2�UTF-8c�\�t|tj�r|jd�}|S)z(if we have bytes, decode them to unicoderQ)�
isinstance�np�bytes_�decode)�ss �=/usr/local/lib/python3.12/site-packages/pandas/io/pytables.py�_ensure_decodedrY�s#���!�R�Y�Y��
�H�H�W����H�c��|�t}|S�N)�_default_encoding��encodings rX�_ensure_encodingr`�s����$���OrZc�<�t|t�rt|�}|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
    )rS�str��names rX�_ensure_strre�s���$����4�y���KrZc���|dz}t|ttf�r-|D�cgc]!}|�t|�rt	||dz��n|��#}}nt|�r
t	||��}|�t|�r|SdScc}w)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)
    �N��scope_level)rS�list�tupler9�Term�len)�whereri�level�terms    rX�_ensure_termrq�s���
�!�O�E��%�$���'��
�����2B�$�1G�D��5�1�9�-�T�Q��	�
�

�%�	 ��U��.���M�S��Z�5�9�T�9��
s�&A2z�
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)�fru�trvz;
: 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_doczio.hdf�dropna_tableF)�	validator�default_format)rurvNc��t�=ddl}|att�5|jj
dk(addd�tStS#1swYtSxYw)Nr�strict)�
_table_mod�tablesr�AttributeError�file�_FILE_OPEN_POLICY�!_table_file_open_policy_is_strict)r�s rX�_tablesr��sS������
�
�n�
%����-�-��9�
.�&�
��:��&�
��s�A
�
Ac
������	�
���
��|r����
����	�
�f
d�}n����
����	�
�f
d�}t|�}t|t�r!t||||��5}||�ddd�y||�y#1swYyxYw)z+store this object, close it if we opened itc�:�
�|j��
����	������
S)N)�format�index�min_itemsize�nan_rep�dropna�data_columns�errorsr_)�append��storer�r�r_r�r�r��keyr�r��values ����������rX�<lambda>zto_hdf.<locals>.<lambda>s1���%�,�,�����%���%���'�
rZc�:�
�|j��
����	������
S)N)r�r�r�r�r�r�r_r���putr�s ����������rXr�zto_hdf.<locals>.<lambda>%s1���%�)�)�����%��%����$�
rZ)�mode�	complevel�complibN)r>rSrb�HDFStore)�path_or_bufr�r�r�r�r�r�r�r�r�r�r�r�r�r_rwr�s ``    ````````  rX�to_hdfr�sp����$�
�
��
�
��!��-�K��+�s�#�
��d�i��
�
�
�e�H�
�
�
	
�+��
�
�s�	A/�/A8c

�F�|dvrtd|�d���|�
t|d��}t|t�r|jstd��|}d}nht
|�}t|t�std	��	tjj|�}
|
std
|�d���t|f||d�|
��}d
}	|�[|j�}t|�dk(rtd��|d}|ddD]}t!||�r�td��|j"}|j%|||||||	|��S#ttf$rd}
Y��wxYw#ttt&f$rGt|t�s5t)t*�5|j-�ddd��#1swY�xYw�wxYw)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 a HDF file from a DataFrame.
    HDFStore : Low-level access to HDF files.

    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+�azmode zG is not allowed while performing a read. Allowed modes are r, r+ and a.Nrgrhz&The HDFStore must be open for reading.Fz5Support for generic buffers has not been implemented.zFile z does not exist)r�r�Trz]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.)rn�start�stop�columns�iterator�	chunksize�
auto_close)�
ValueErrorrqrSr��is_open�OSErrorr>rb�NotImplementedError�os�path�exists�	TypeError�FileNotFoundError�groupsrm�_is_metadata_of�_v_pathname�select�LookupErrorrr��close)r�r�r�r�rnr�r�r�r�r��kwargsr�r�r�r��candidate_only_group�group_to_checks                 rX�read_hdfr�<s���^�#�#���D�6�-�
.�
�	
�

���U��2���+�x�(��"�"��B�C�C����
�$�[�1���+�s�+�%�G��
�	��W�W�^�^�K�0�F��#�e�K�=��$H�I�I���I�4��I�&�I���
�%��;��\�\�^�F��6�{�a�� �D���$*�!�9� �#)���*��&�~�7K�L�$�;���#-�'�2�2�C��|�|��������!��	
�		
��A�:�&�	��F�	��T
�	�;�/���+�x�0��.�)����
�*�	�*�	���
�s=�6D.�8AE�=0E�.E�E�3F �8F�		F �F	�	F c���|j|jkry|}|jdkDr=|j}||k(r|jdk(ry|j}|jdkDr�=y)zDCheck if a given group is a metadata group for a given parent_group.Frg�metaT)�_v_depth�	_v_parent�_v_name)�group�parent_group�current�parents    rXr�r��sk���~�~��.�.�.���G�
�
�
�Q�
��"�"���\�!�g�o�o��&?���#�#��	�
�
�Q�
�
rZc�j�eZdZUdZded<ded<				d2							d3d�Zd4d�Zed	��Zed4d
��Z	d5d�Z
d6d�Zd6d
�Zd7d�Z
d8d�Zd9d�Zd4d�Zd:d�Z								d;d�Zd<d=d�Zd>d�Zd?d�Zd@dAd�ZdBd�ZedCd��ZdDdEd�Zd5d�Z							dF							dGd�Z			dH					dId�Z		dJ							dKd�Z								dL					dMd�Z												dN																					dOd �ZdHd6d!�Z 															dP																					dQd"�Z!			dR					dSd#�Z"			dH							dTd$�Z#dUd%�Z$dVdWd&�Z%dXd'�Z&dYd(�Z'							dZ											d[d)�Z(d4d*�Z)dBd+�Z*d\d,�Z+				d]							d^d-�Z,															d_																					d`d.�Z-dad/�Z.dbd0�Z/dcd1�Z0y)dr�aS	
    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
    zFile | None�_handlerb�_modeNc��d|vrtd��td�}|�;||jjvr#td|jj�d���|�|�|jj}t|�|_|�d}||_d|_|r|nd|_	||_
||_d|_|jd	d|i|��y)
Nr�z-format is not a defined argument for HDFStorer�zcomplib only supports z
 compression.r�rr��)r�r�filters�all_complibs�default_complibr>�_pathr�r��
_complevel�_complib�_fletcher32�_filters�open)�selfr�r�r�r��
fletcher32r�r�s        rX�__init__zHDFStore.__init__*s����v���L�M�M�+�H�5����7�&�.�.�2M�2M�#M��(����)D�)D�(E�]�S��
��?�y�4��n�n�4�4�G�#�D�)��
��<��D���
����'0�)�a�����
�%�����
���	�	�&�t�&�v�&rZc��|jSr\�r��r�s rX�
__fspath__zHDFStore.__fspath__Ks���z�z�rZc�j�|j�|j�J�|jjS)zreturn the root node)�_check_if_openr��rootr�s rXr�z
HDFStore.rootNs0��	
�����|�|�'�'�'��|�|� � � rZc��|jSr\r�r�s rX�filenamezHDFStore.filenameU����z�z�rZc�$�|j|�Sr\)�get�r�r�s  rX�__getitem__zHDFStore.__getitem__Ys���x�x��}�rZc�(�|j||�yr\r�)r�r�r�s   rX�__setitem__zHDFStore.__setitem__\s������e�rZc�$�|j|�Sr\)�remover�s  rX�__delitem__zHDFStore.__delitem___s���{�{�3��rZc��	|j|�S#ttf$rYnwxYwtdt	|�j
�d|�d���)z$allow attribute access to get stores�'z' object has no attribute ')r��KeyErrorrr��type�__name__)r�rds  rX�__getattr__zHDFStore.__getattr__bsW��	��8�8�D�>�!���/�*�	��	�����T�
�#�#�$�$?��v�Q�G�
�	
s��%�%c�V�|j|�}|�|j}|||ddfvryy)zx
        check for existence of this key
        can match the exact pathname or the pathnm w/o the leading '/'
        NrgTF)�get_noder�)r�r��noderds    rX�__contains__zHDFStore.__contains__ls<��
�}�}�S�!�����#�#�D��t�T�!�"�X�&�&��rZc�4�t|j��Sr\)rmr�r�s rX�__len__zHDFStore.__len__xs���4�;�;�=�!�!rZc�N�t|j�}t|��d|�d�S)N�
File path: �
)r@r�r�)r��pstrs  rX�__repr__zHDFStore.__repr__{s'���D�J�J�'���t�*��]�4�&��3�3rZc��|Sr\r�r�s rX�	__enter__zHDFStore.__enter__s���rZc�$�|j�yr\)r�)r��exc_type�	exc_value�	tracebacks    rX�__exit__zHDFStore.__exit__�s
��	
�
�
�rZc��|dk(r(|j�D�cgc]}|j��c}S|dk(rC|j�J�|jjdd��D�cgc]}|j��c}St	d|�d���cc}wcc}w)a�
        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

        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
        �pandas�native�/�Table)�	classnamez8`include` should be either 'pandas' or 'native' but is 'r�)r�r�r��
walk_nodesr�)r��include�ns   rX�keysz
HDFStore.keys�s���<�h��+/�;�;�=�9�=�a�A�M�M�=�9�9�
��
 ��<�<�+�+�+�'+�|�|�'>�'>�s�g�'>�'V��'V�!��
�
�'V��
��F�w�i�q�Q�
�	
��:��s�B� B
c�4�t|j��Sr\)�iterr
r�s rX�__iter__zHDFStore.__iter__�s���D�I�I�K� � rZc#�VK�|j�D]}|j|f���y�w)z'
        iterate on key->group
        N)r�r��r��gs  rX�itemszHDFStore.items�s'��������A��-�-��"�"��s�')c�Z�t�}|j|k7rP|jdvr|dvrn6|dvr2|jr&td|j�d|j�d���||_|jr|j�|jrN|jdkDr?t�j|j|j|j��|_
tr|jr
d	}t|��|j|j|jfi|��|_y
)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�)rzRe-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�rr�r�r��Filtersr�r�r�r�r��	open_filer�)r�r�r�r��msgs     rXr�z
HDFStore.open�s������:�:����z�z�Z�'�D�K�,?������<�<�/�/��
�
�|�=�����U8�8���
�D�J��<�<��J�J�L��?�?�t����2�#�I�-�-�������4�;K�;K�.��D�M�-����*�
��S�/�!�'�v�'�'��
�
�D�J�J�I�&�I��rZc�^�|j�|jj�d|_y)z0
        Close the PyTables file handle
        N)r�r�r�s rXr�zHDFStore.close�s%���<�<�#��L�L��� ���rZc�Z�|j�yt|jj�S)zF
        return a boolean indicating whether the file is open
        F)r��bool�isopenr�s rXr�zHDFStore.is_open�s&��
�<�<����D�L�L�'�'�(�(rZc��|j�c|jj�|rFtt�5t	j
|jj
��ddd�yyy#1swYyxYw)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��flushrr�r��fsync�fileno)r�rs  rXrzHDFStore.flush�s]�� �<�<�#��L�L��� ���g�&��H�H�T�\�\�0�0�2�3�'�&��$�'�&�s�.A1�1A:c��t�5|j|�}|�td|�d���|j|�cddd�S#1swYyxYw)a
        Retrieve pandas object stored in file.

        Parameters
        ----------
        key : str

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

        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)rr�r��_read_group�r�r�r�s   rXr�zHDFStore.getsK��*�^��M�M�#�&�E��}��!1�#��l�C�D�D��#�#�E�*�
�^�^�s�3A�Ac	����|j|�}	|	�td|�d���t|d��}|j|	���j	���fd�}
t|�|
|�j|||||��
}|j�S)a6
        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.

        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
        r r!rgrhc�.���j|||���S)N)r�r�rnr�)�read)�_start�_stop�_wherer�rWs   ��rX�funczHDFStore.select.<locals>.funcys����6�6��U�&�'�6�R�RrZ�rn�nrowsr�r�r�r�r�)r�r�rq�_create_storer�
infer_axes�
TableIteratorr,�
get_result)
r�r�rnr�r�r�r�r�r�r�r*�itrWs
     `      @rXr�zHDFStore.select/s����@�
�
�c�"���=��-�c�U�,�?�@�@��U��2������&��	����	S���
����'�'�����!�
���}�}��rZc��t|d��}|j|�}t|t�st	d��|j|||��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
        rgrhz&can only read_coordinates with a table�rnr�r�)rq�
get_storerrSrr��read_coordinates)r�r�rnr�r��tbls      rX�select_as_coordinateszHDFStore.select_as_coordinates�sL��4�U��2���o�o�c�"���#�u�%��D�E�E��#�#�%�u�4�#�H�HrZc��|j|�}t|t�std��|j	|||��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)�columnr�r�)r4rSrr��read_column)r�r�r9r�r�r6s      rX�
select_columnzHDFStore.select_column�s>��F�o�o�c�"���#�u�%��?�@�@����f�E���E�ErZc
������t|d��}t|ttf�rt	|�dk(r|d}t|t
�r|j
||�|||||	��St|ttf�std��t	|�std��|�|d}|D�
cgc]}
|j|
���c}
�|j|�}d}tj||fgt�|��D]d\}
}
|
�td|
�d	���|
jstd
|
j�d���|�
|
j }�K|
j |k7s�[td���D�cgc]}t|t"�s�|��}}|D�
chc]}
|
j$dd��c}
j'�����fd
�}t)||||||||||	��
}|j+d��Scc}
wcc}wcc}
w)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
        rgrhr)r�rnr�r�r�r�r�r�zkeys must be a list/tuplez keys must have a non-zero lengthNzInvalid table [�]zobject [z>] is not a table, and cannot be used in all select as multiplez,all tables must have exactly the same nrows!c	����D�cgc]}|j|�||����}}t|�d��j�Scc}w)N�rnr�r�r�F)�axis�verify_integrity)r&r3�_consolidate)r'r(r)rx�objsr@r��tblss     ���rXr*z)HDFStore.select_as_multiple.<locals>.func2sU���
���A����V�W�F���O��
���$�T�E�B�O�O�Q�Q��
s�Ar+T)�coordinates)rqrSrjrkrmrbr�r�r�r4�	itertools�chain�zipr��is_table�pathnamer,r�non_index_axes�popr/r0)r�r
rn�selectorr�r�r�r�r�r��krWr,rx�x�_tblsr*r1r@rDs    `             @@rX�select_as_multiplezHDFStore.select_as_multiple�s���V�U��2���d�T�5�M�*�s�4�y�A�~���7�D��d�C� ��;�;������!�#�%��	�	
��$��u�
�.��7�8�8��4�y��?�@�@����A�w�H�-1�1�D�q�����"�D�1���O�O�H�%�����O�O�a��]�O�S��t�_�E�D�A�q��y�����1�5�6�6��:�:���q�z�z�l�+)�)���
�}��������E�!� �!O�P�P�F� !�9�D�q�J�q�%�$8��D��9�16�6��1�� � ��#�A�&��6�:�:�<��		R���
��������!�
���}�}��}�.�.��g2��*:��7s�%G�!G�7G�G#c��|�td�xsd}|j|�}|j|||||||||	|
|||
|��y)a�
        Store object in HDFStore.

        Parameters
        ----------
        key : str
        value : {Series, DataFrame}
        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.
        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.
        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.

        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_formatru)r�r�r�r�r�r�r�r�r_r��track_timesr�)r�_validate_format�_write_to_group)r�r�r�r�r�r�r�r�r�r�r�r_r�rTr�s               rXr�zHDFStore.putMsg��p�>�� 7�8�C�G�F��&�&�v�.������������%��%���#��	�	
rZc��t|d��}	|j|�}tj|||�rjjd��yjstd��|j|||��S#t$r�t$r�t$rB}|�td�|�|j
|�}|�|jd��Yd}~yYd}~��d}~wwxYw)	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

        rgrhNz5trying to remove a node with a non-None where clause!T��	recursivez7can only remove with where on objects written as tablesr3)
rqr4r��AssertionError�	Exceptionr�r��	_f_remove�com�all_noner�rI�delete)r�r�rnr�r�rW�errr�s        rXr�zHDFStore.remove�s���*�U��2��	�����$�A�.�<�<��u�d�+�
�G�G�����-��:�:� �M����8�8�%�u�4�8�@�@��?�	���	���
	�� � �K����
�=�=��%�D��������.�� ��
	�s�A?�?C�3C�Cc��|	�td��|�td�}|�td�xsd}|j|�}|j|||||||||
|||
||||��y)a|
        Append to Table in file.

        Node must already exist and be Table format.

        Parameters
        ----------
        key : str
        value : {Series, DataFrame}
        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.
        index : bool, default True
            Write DataFrame index as a column.
        append       : bool, default True
            Append the input data to the existing.
        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>`__.
        min_itemsize : dict of columns that specify minimum str sizes
        nan_rep      : str to use as str nan representation
        chunksize    : size to chunk the writing
        expectedrows : expected TOTAL row size of this table
        encoding     : default None, provide an encoding for str
        dropna : bool, default False, optional
            Do not write an ALL nan row to the store settable
            by the option 'io.hdf.dropna_table'.

        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_columnszio.hdf.dropna_tablerSrv)r��axesr�r�r�r�r�r�r��expectedrowsr�r�r_r�)r�rrUrV)r�r�r�r�rbr�r�r�r�r�r�r�r�rcr�r�r_r�s                  rXr�zHDFStore.append�s���R���P��
��>�� 5�6�F��>�� 7�8�C�G�F��&�&�v�.�������������%���%��%���!	�	
rZc���|�td��t|t�std��||vrtd��t	tt
t�j��t
tt���z
��}d}	g}
|j�D](\}}|�|	�td��|}	�|
j|��*|	�W�j|}
|
jt|
��}t!|
j#|��}|
j%|�||	<|�||}|rK�fd�|j'�D�}t	|�}|D]}|j)|�}��j*|�|j-dd�}|j�D]e\}}||k(r|nd}�j/||��}|�)|j�D��cic]
\}}||vs�||��c}}nd}|j0||f||d	�|���gycc}}w)
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 Nonec3�\�K�|]#}�|jd��j���%y�w)�all)�howN)r�r�)�.0�colsr�s  �rX�	<genexpr>z.HDFStore.append_to_multiple.<locals>.<genexpr>�s*�����O�J�D�E�$�K�&�&�5�&�1�7�7�J�s�),r��r@)r�r�)r�rS�dictr��nextr�set�range�ndim�	_AXES_MAPr�r�extendrb�
differencer-�sorted�get_indexer�take�values�intersection�locrL�reindexr�)r��dr�rMr�rbr�r�r@�
remain_key�
remain_valuesrN�v�ordered�ordd�idxs�valid_indexr�r��dc�valr��filtereds  `                    rX�append_to_multiplezHDFStore.append_to_multiple8s)���>���B��
�
�!�T�"��)��
�
�1���O��
�
�D��U�5�:�:�.�/�#�i��U��6L�2M�M�N�O���
� �
��G�G�I�D�A�q��y��)�$�V����
��$�$�Q�'���!��j�j��&�G��%�%�e�M�&:�;�D��'�-�-�d�3�4�D�#�L�L��.�A�j�M����X�;�L��O�A�H�H�J�O�D��t�*�K���)�6�6�u�=����I�I�k�*�E��z�z�.�$�7���G�G�I�D�A�q�!"�h���D�B��-�-���-�-�C� �+�1=�0B�0B�0D�Q�0D���e��q���e��0D�Q��
�

�D�K�K��3�Q�R�h�Q�&�Q���Rs�
G<�G<c��t�|j|�}|�yt|t�st	d��|j|||��y)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��optlevel�kind)r�r4rSrr��create_index)r�r�r�r�r�rWs      rX�create_table_indexzHDFStore.create_table_index�sG��>	�	��O�O�C� ���9���!�U�#��O�P�P�	���w����ErZc��t�|j�|j�J�t�J�|jj	�D�cgc]}t|tjj�sYt|jdd�s@t|dd�s3t|tjj�r|jdk7r|���c}Scc}w)a�
        Return a list of all the top-level nodes.

        Each node returned is not a pandas storage object.

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

        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)]]
        N�pandas_typerv)
r�r�r�r��walk_groupsrS�link�Link�getattr�_v_attrsrvrr�rs  rXr�zHDFStore.groups�s���,	�	������|�|�'�'�'��%�%�%��\�\�-�-�/�
�/���q�*�/�/�"6�"6�7��A�J�J�
�t�<��q�'�4�0�"�1�j�&6�&6�&<�&<�=�!�)�)�w�BV�
�/�
�	
��
s�
BCc#�LK�t�|j�|j�J�t�J�|jj	|�D]�}t|jdd���g}g}|jj�D]w}t|jdd�}|�At|tjj�s�A|j|j��]|j|j��y|jjd�||f����y�w)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`.

        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_childrenrwrSr��Groupr�r�r��rstrip)r�rnrr��leaves�childr�s       rX�walkz
HDFStore.walk�s�����N	�	������|�|�'�'�'��%�%�%����)�)�%�0�A��q�z�z�=�$�7�C���F��F����-�-�/��%�e�n�n�m�T�J���&�!�%��)9�)9�)?�)?�@��
�
�e�m�m�4��M�M�%�-�-�0�
0��=�=�'�'��,�f�f�=�=�1�s
�CD$�AD$c�f�|j�|jd�sd|z}|j�J�t�J�	|jj	|j
|�}t|tj�sJt|���|S#tjj$rYywxYw)z9return the node with the key or None if it does not existrN)r��
startswithr�r�r�r��
exceptions�NoSuchNodeErrorrSrGr�)r�r�r�s   rXr�zHDFStore.get_node$s��������~�~�c�"���)�C��|�|�'�'�'��%�%�%�	��<�<�(�(����C�8�D��$�
���0�<�$�t�*�<�0����	�$�$�4�4�	��	�s�&B�B0�/B0c��|j|�}|�td|�d���|j|�}|j�|S)z<return the storer object for a key, raise if not in the filer r!)r�r�r-r.)r�r�r�rWs    rXr4zHDFStore.get_storer4sH���
�
�c�"���=��-�c�U�,�?�@�@�����&��	�����rZc	�:�t|||||��}	|�t|j��}t|ttf�s|g}|D]�}
|j|
�}|��|
|	vr|r|	j
|
�|j|
�}t|t�r`d}
|r0|jD�cgc]}|js�|j��}
}|	j|
||
t|dd�|j����|	j|
||j����|	Scc}w)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�NFr�)r�r�r_r^)r�rjr
rSrkr4r�r�rrb�
is_indexedrdr�r�r_r�)r�r�r��propindexesr
r�r�r��	overwrite�	new_storerNrW�datar�r�s               rX�copyz
HDFStore.copy>s��8��t�W�	�j�
�	��<���	�	��$�D��$���
�.��6�D��A�����"�A��}��	�>� �!�(�(��+��{�{�1�~���a��'�.3�E�"�12��� H��A�1�<�<������ H��$�$���#�%,�Q���%E�!"���%���M�M�!�T�A�J�J�M�?�)�,���!Is�(D�:Dc�X�t|j�}t|��d|�d�}|jr�t	|j��}t
|�rwg}g}|D]\}	|j|�}|�F|jt|jxs|��|jt|xsd���^|td||�z
}|S|dz
}|S|d	z
}|S#t$r�t$r;}|j|�t|�}	|jd|	�d��Yd}~��d}~wwxYw)
a
        Print detailed information on the store.

        Returns
        -------
        str

        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.info())  # doctest: +SKIP
        >>> store.close()  # doctest: +SKIP
        <class 'pandas.io.pytables.HDFStore'>
        File path: store.h5
        /data    frame    (shape->[2,2])
        r�r�Nzinvalid_HDFStore nodez[invalid_HDFStore node: r=��EmptyzFile is CLOSED)
r@r�r�r�rtr
rmr4r�rJrZr[r?)
r�r��output�lkeysr
rwrNrW�detail�dstrs
          rX�infoz
HDFStore.infoys2��&�D�J�J�'����J�<�}�T�F�"�5���<�<��4�9�9�;�'�E��5�z������A�J� �O�O�A�.���=� �K�K��Q�Z�Z�_�1�(E�F�"�M�M�,�q�7S�<S�*T�U����&��T�6�2�2���
�	�'�!���
�
�&�&�F��
��*���$�J����A��+�F�3���
�
�(@���a�&H�I�I��J�s�!AC�D)�.1D$�$D)c�L�|jst|j�d���y)Nz file is not open!)r�rr�r�s rXr�zHDFStore._check_if_open�s%���|�|�!�T�Z�Z�L�0B�"C�D�D�rZc�x�	t|j�}|S#t$r}td|�d��|�d}~wwxYw)zvalidate / deprecate formatsz#invalid HDFStore format specified [r=N)�_FORMAT_MAP�lowerr�r�)r�r�r`s   rXrUzHDFStore._validate_format�sK��	V� �����0�F��
���	V��A�&���K�L�RU�U��	V�s��	9�4�9c	��|�!t|ttf�std��t	t|jdd��}t	t|jdd��}|�t|�St�t�J�t|dd�s$t|tjj�rd}d}n*td��t|t�rd	}nd
}|dk(r|dz
}d|vrttd�}	||}	|	||||��S|�q|�o|dk(r3t|dd�}|�[|jdk(rd}nI|jdkDr:d}n7|dk(r2t|dd�}|�#|jdk(rd}n|jdkDrd}t t"t$t&t(t*d�}	||}	|	||||��S#t$r#}
td
|�dt|��d|���|
�d}
~
wwxYw#t$r#}
td|�dt|��d|���|
�d}
~
wwxYw)z"return a suitable class to operateNz(value must be None, Series, or DataFramer��
table_typerv�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->�r_r��series_tabler�rg�appendable_series�appendable_multiseries�appendable_frame�appendable_multiframe)r�r�r�r�r��wormz<cannot properly create the storer for: [_TABLE_MAP] [group->)rSr1r+r�rYr�r�r�r�rvr�SeriesFixed�
FrameFixedr�r��nlevels�GenericTable�AppendableSeriesTable�AppendableMultiSeriesTable�AppendableFrameTable�AppendableMultiFrameTable�	WORMTable)
r�r�r�r�r_r��pt�tt�_STORER_MAP�clsr`r��
_TABLE_MAPs
             rXr-zHDFStore._create_storer�sY����Z���	�7J�%K��F�G�G�
�W�U�^�^�]�D�I�
J��
�W�U�^�^�\�4�H�
I���:��}��	�!�-�-�-��5�'�4�0�J��:�+�+�1�1�5�'�B�(�B�#�1���
�e�V�,�!�B� �B��W�$��(�N�B��"��%0�:�F�K�
�!�"�o���t�U�X�f�E�E��:�� ���'�#�E�7�D�9�E��(� �=�=�A�-�!4�B�"�]�]�Q�.�!9�B��=�(�#�E�7�D�9�E��(� �=�=�A�-�!3�B�"�]�]�Q�.�!8�B�*�!6�&@� 4�%>��

�
�	��R�.�C��4���&�A�A��U�
��S��g�X�d�5�k�]�)�F�8�E�����
��H�	��N��'��$�u�+��i��x�A���
��	�s0�,F#�G�#	G�,G
�
G�	G>�G9�9G>c��t|dd�r|dk(s|ry|j||�}|j|||||��}|rQ|jr|jr|dk(r|jrtd��|js!|j
�n|j
�|js
|rtd��|j||||||	|
|||
|||��
t|t�r|r|j|��yyy)	N�emptyrvr�ruzCan only append to Tablesz0Compression not supported on Fixed format stores)
�objrbr�r�r�r�r�r�rcr�r�r�rT)r�)r��_identify_groupr-rI�	is_existsr��set_object_info�writerSrr�)r�r�r�r�rbr�r�r�r�r�r�r�rcr�r�r�r_r�rTr�rWs                     rXrVzHDFStore._write_to_groups��.�5�'�4�(�f��.?�6���$�$�S�&�1������v�u�x�PV��W����:�:�!�*�*��7�1B�q�{�{� �!<�=�=��;�;��!�!�#�
�����z�z�g��O�P�P�	
��������!�%��%���%�#�	�	
� �a���E�
�N�N�5�N�)�%*�rZc�d�|j|�}|j�|j�Sr\)r-r.r&)r�r�rWs   rXr"zHDFStore._read_groupUs&������&��	�����v�v�x�rZc��|j|�}|j�J�|�!|s|jj|d��d}|�|j|�}|S)z@Identify HDF5 group based on key, delete/create group if needed.NTrX)r�r��remove_node�_create_nodes_and_group)r�r�r�r�s    rXr�zHDFStore._identify_groupZsb���
�
�c�"���|�|�'�'�'���V��L�L�$�$�U�d�$�;��E��=��0�0��5�E��rZc�
�|j�J�|jd�}d}|D]\}t|�s�|}|jd�s|dz
}||z
}|j	|�}|�|jj||�}|}�^S)z,Create nodes from key and return group name.r)r��splitrm�endswithr��create_group)r�r��pathsr��p�new_pathr�s       rXr�z HDFStore._create_nodes_and_groupls����|�|�'�'�'��	�	�#������A��q�6���H��=�=��%��C�����M�H��M�M�(�+�E��}����1�1�$��:���D���rZ)r�NNF)r�rbr��
int | Noner�r�return�None�r�rb�r�rb)r�rbr�r�)rdrb)r�rbr�r�r��int)r�rM)r�ztype[BaseException] | Noner�zBaseException | Noner�zTracebackType | Noner�r�)r)rrbr��	list[str])r�z
Iterator[str])r�zIterator[tuple[str, list]])r�)r�rbr�r��r�r��r�r�F)rrr�r�)NNNNFNF)r�rbr�rr�r�r�r�NNN�r�rbr�r�r�r��NN)r�rbr9rbr�r�r�r�)NNNNNFNF)r�rr�r�r�r)NTFNNNNNNrTF)r�rbr��DataFrame | Seriesr�rr�rr�r�r��int | dict[str, int] | Noner�� Literal[True] | list[str] | Noner�rbrTrr�rr�r�)NNTTNNNNNNNNNNr)r�rbr�r�r��bool | list[str]r�rr�r�r�r�r�r�r��bool | Noner�r�r�rbr�r�)NNF)r{rlr�rr�r�)r�rbr�r�r��
str | Noner�r�)r�rj)r)rnrbr�z*Iterator[tuple[str, list[str], list[str]]])r�rbr�zNode | None)r�rbr��GenericFixed | Table)rTNNNFT)r�rbr�rr�r�r�rr�rr�r�)r�rbr�rb)NNrQr)r�zDataFrame | Series | Noner_rbr�rbr�r�)NTFNNNNNNFNNNrT)r�rbr�r�r�r�r�rr�r�r�r�r�r�r�rr�rbrTrr�r�)r�rG)r�rbr�rr�rG)r�rbr�rG)1r��
__module__�__qualname__�__doc__�__annotations__r�r��propertyr�r�r�r�r�r�r�r�r�r�rr
r
rr�r�r�rr�r�r7r;rQr�r�r�r�r�r�r�r�r4r�r�r�rUr-rVr"r�r�r�rZrXr�r��s?��?�B���J�
� $�� �
'��'��	'��
'�
�'�B��!��!������� �
�
�"�4���,��(��(�	�

��(
�T!�#�+J�Z��)��)�4�,+�@��
��� $� �[�
�[��[��[��[�@� ��I�
�I��	I�
�I�H!��&F�
�&F��&F��	&F�
�&F�V����
�� $� �w/��w/��w/��w/�z���� $�48��9=��� ��J
�
�J
�"�J
�
�J
��
J
��J
�2�J
�7�J
��J
��J
��J
� 
�!J
�X7A�z�
�"&��� $��48�� $��"�9=���%d
�
�d
�"�d
� �
d
��d
��d
�2�d
��d
��d
� 7�!d
�$�%d
�&
�'d
�V�
��_R��_R��_R�
�_R�H�#��&F�
�&F��	&F�
�&F�
�
&F�P%
�N:>�x� �� �
�� $� ��9��9��	9��9��9��9�
�9�v0�jE���+/���
YB�)�	YB�
�YB��
YB�
�YB�@�"&��� $��48� $������� �'<*�
�<*�"�<*� �
<*��<*��<*�2�<*��<*��<*�$�%<*�&�'<*�(
�)<*�|�
�$rZr�c�t�eZdZUdZded<ded<ded<					d
											dd	�Zdd
�Zdd�Zddd�Zy)r/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�rWNc�,�||_||_||_||_|jjr|�d}|�d}|�|}t||�}||_||_||_d|_	|s|	�|	�d}	t|	�|_|
|_yd|_|
|_y)Nr順)
r�rWr*rnrI�minr,r�r�rEr�r�r�)r�r�rWr*rnr,r�r�r�r�r�s           rXr�zTableIterator.__init__�s�����
������	���
��6�6�?�?��}����}����|����u�d�#�D���
���
���	�����y�,�� �"�	� ��^�D�N�%���"�D�N�$��rZc#�^K�|j}|j�td��||jkrgt	||j
z|j�}|j
dd|j||�}|}|�t|�s�b|��||jkr�g|j�y�w)Nz*Cannot iterate until get_result is called.)	r�rEr�r�r�r�r*rmr�)r�r�r�r�s    rXr
zTableIterator.__iter__�s������*�*�����#��I�J�J���	�	�!��w����/����;�D��I�I�d�D�$�*:�*:�7�4�*H�I�E��G��}�C��J���K���	�	�!�	
�
�
��s�BB-�B-c�R�|jr|jj�yyr\)r�r�r�r�s rXr�zTableIterator.close�s���?�?��J�J����rZc��|j�Rt|jt�st	d��|jj|j��|_|S|rbt|jt�st	d��|jj|j|j|j��}n|j}|j|j|j|�}|j�|S)Nz0can only use an iterator or chunksize on a table)rnz$can only read_coordinates on a tabler3)r�rSrWrr�r5rnrEr�r�r*r�)r�rErn�resultss    rXr0zTableIterator.get_result�s����>�>�%��d�f�f�e�,�� R�S�S�#�v�v�6�6�T�Z�Z�6�H�D���K���d�f�f�e�,�� F�G�G��F�F�+�+��j�j��
�
����,��E��J�J�E��)�)�D�J�J��	�	�5�9���
�
���rZ)NNFNF)r�r�rWr�r�rr�r�r�rr�r��r�rBr�r�)rEr)	r�r�r�r�r�r�r
r�r0r�rZrXr/r/�sz���&���O����
�� $� �(%��(%� �(%��(%��(%��(%�
�(%�T� �rZr/c�r�eZdZUdZdZded<dZded<gd�Z													d!					d"d�Ze	d#d	��Z
e	d$d
��Zd%d�Zd$d�Z
d&d
�Zd'd�Ze	d'd��Z								d(d�Zd�Ze	d��Ze	d��Ze	d��Ze	d��Zd)d�Zd*d+d�Zd+d�Zd,d�Zd*d�Zd-d�Zd+d�Zd+d�Zd+d�Zd.d�Z d.d �Z!y)/�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_nameNc��t|t�std��||_||_||_||_|xs||_||_||_	||_
|	|_|
|_||_
||_|
|_||_|�|j#|�t|jt�sJ�t|jt�sJ�y)Nz`name` must be a str.)rSrbr�rwr��typrd�cnamer@�posrr	r
rrvr��metadata�set_pos)r�rdrwr�rr
r@rrr	r
rrvr�rs               rXr�zIndexCol.__init__s���"�$��$��4�5�5������	������	��]�d��
���	������	����$��������
���	� ��
��?��L�L����$�)�)�S�)�)�)��$�*�*�c�*�*�*rZc�.�|jjSr\)r�itemsizer�s rXrzIndexCol.itemsize/s���x�x� � � rZc� �|j�d�S)N�_kindrcr�s rX�	kind_attrzIndexCol.kind_attr4����)�)��E�"�"rZc�T�||_|�|j�||j_yyy)z,set the position of this column in the TableN)rr�_v_pos)r�rs  rXrzIndexCol.set_pos8s)������?�t�x�x�3�!�D�H�H�O� 4�?rZc
��ttt|j|j|j
|j|jf��}djtgd�|�D��cgc]\}}|�d|����c}}�Scc}}w)N�,)rdr
r@rr��->)
rk�mapr@rdr
r@rr��joinrH�r��tempr�r�s    rXr�zIndexCol.__repr__>s������t�y�y�$�*�*�d�i�i����4�9�9�U�V�
���x�x�#&�&N�PT�"U�
�"U�J�C���%�r�%��!�"U�
�
�	
��
��-B
c�0���t��fd�dD��S)�compare 2 col itemsc3�T�K�|]}t�|d�t�|d�k(���!y�wr\�r��rhr��otherr�s  ��rXrjz"IndexCol.__eq__.<locals>.<genexpr>Ks0�����
�5��
�D�!�T�"�g�e�Q��&=�=�5���%()rdr
r@r�rf�r�r&s``rX�__eq__zIndexCol.__eq__Is����
�5�
�
�	
rZc�&�|j|�Sr\)r*r)s  rX�__ne__zIndexCol.__ne__Ps���;�;�u�%�%�%rZc��t|jd�syt|jj|j�j
S)z%return whether I am an indexed columnriF)�hasattrrvr�rir
r�r�s rXr�zIndexCol.is_indexedSs4���t�z�z�6�*���t�z�z����
�
�3�>�>�>rZc���t|tj�sJt|���|jj
�||jj�}t|j�}t||||�}i}t|j�|d<|j�t|j�|d<t}tj|jd�st|jt �rt"}n|jdk(rd|vrd�}	||fi|��}t'||j(�}	|	|	fS#t$$rd|vrd|d<||fi|��}Y�7wxYw)zV
        Convert the data from this selection to the appropriate pandas type.
        Nrdr�M�i8c�t�tj||jdd���j|d�S)Nr)rrd)r/�
from_ordinalsr��_rename)rO�kwdss  rXr�z"IndexCol.convert.<locals>.<lambda>{s5���(A�(A�������.�)��g��V���)rZ)rSrT�ndarrayr��dtype�fieldsr
r�rYr��_maybe_convertr
rr-r�is_np_dtyper'r,r��_set_tzr	)
r�rwr�r_r��val_kindr��factory�new_pd_index�final_pd_indexs
          rX�convertzIndexCol.convert[sI���&�"�*�*�-�;�t�F�|�;�-��<�<���*��D�J�J�'�,�,�.�F�"�4�9�9�-�����(�F�C����(����9��v���9�9� �,�T�Y�Y�7�F�6�N�/4���?�?�6�<�<��-���L�L�/�2
�$�G�
�\�\�T�
!�f��&6�
�G�	5�"�6�4�V�4�L�!��t�w�w�7���~�-�-���	5����!%��v��"�6�4�V�4�L�	5�s�	E�E�Ec��|jS)zreturn the values�rwr�s rX�	take_datazIndexCol.take_data�s���{�{�rZc�.�|jjSr\)rvr�r�s rX�attrszIndexCol.attrs�����z�z�"�"�"rZc�.�|jjSr\�rv�descriptionr�s rXrIzIndexCol.description�����z�z�%�%�%rZc�D�t|j|jd�S)z!return my current col descriptionN)r�rIr
r�s rX�colzIndexCol.col�s���t�'�'����T�:�:rZc��|jS�zreturn my cython valuesrBr�s rX�cvalueszIndexCol.cvalues�s���{�{�rZc�,�t|j�Sr\)rrwr�s rXr
zIndexCol.__iter__�s���D�K�K� � rZc��t|j�dk(rst|t�r|j	|j
�}|�E|jj|kr+t�j||j��|_yyyy)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)rr)rYr�rSrlr�rdrrr��	StringColr)r�r�s  rX�maybe_set_sizezIndexCol.maybe_set_size�su���4�9�9�%��1��,��-�+�/�/��	�	�:���'�D�H�H�,=�,=��,L�"�9�.�.��$�(�(�.�S���-M�'�	2rZc��yr\r�r�s rX�validate_nameszIndexCol.validate_names����rZc���|j|_|j�|j|�|j|�|j	|�|j�yr\)rv�validate_col�
validate_attr�validate_metadata�write_metadata�set_attr)r��handlerr�s   rX�validate_and_setzIndexCol.validate_and_set�sL���]�]��
��������6�"����w�'����G�$��
�
�rZc	���t|j�dk(r`|j}|�R|�|j}|j|kr)t	d|�d|j
�d|j�d���|jSy)z:validate this column: return the compared against itemsizerRNz#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)rYr�rLrr�r
)r�r�cs   rXrYzIndexCol.validate_col�s����4�9�9�%��1����A��}��#�#�}�}�H��:�:��(�$�=�h�Z�H� �J�J�<�(��J�J�<�(<�<����z�z�!�rZc��|rPt|j|jd�}|�,||jk7rt	d|�d|j�d���yyy)Nzincompatible kind in col [� - r=)r�rErr�r�)r�r��
existing_kinds   rXrZzIndexCol.validate_attr�s]���#�D�J�J�����E�M��(�]�d�i�i�-G��0���s�4�9�9�+�Q�O���.H�(�rZc��|jD]�}t||d�}|j|ji�}|j	|�}||vrp|�n||k7ri|dvrCt
|||fz}t
j|tt���d||<t||d���td|j�d|�d|�d|�d�	��|�|���|||<��y)	z
        set/update the info for this indexable with the key/value
        if there is a conflict raise/warn as needed
        N)rr
��
stacklevelzinvalid info for [z] for [z], existing_value [z] conflicts with new value [r=)�_info_fieldsr��
setdefaultrdr�rs�warnings�warnrr�setattrr�)r�r�r�r��idx�existing_value�wss       rX�update_infozIndexCol.update_info�s���
�$�$�C��D�#�t�,�E��/�/�$�)�)�R�0�C� �W�W�S�\�N��c�z�e�/�N�e�4K��0�0�/�3���2N�N�B��M�M��4�AQ�AS��
 $�C��H��D�#�t�,�%�,�T�Y�Y�K�w�s�e�D+�+9�*:�;&�&+�W�A�/���
�"�n�&@� ��C��1%rZc�v�|j|j�}|�|jj|�yy)z!set my state from the passed infoN)r�rd�__dict__�update)r�r�rms   rX�set_infozIndexCol.set_info�s0���h�h�t�y�y�!���?��M�M� � ��%�rZc�Z�t|j|j|j�y)zset the kind for this columnN)rlrErr�r�s rXr]zIndexCol.set_attr�s����
�
�D�N�N�D�I�I�6rZc��|jdk(rH|j}|j|j�}|�|�t	||dd��std��yyyy)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    rXr[zIndexCol.validate_metadata	sp���9�9�
�"��=�=�L�"�0�0����<�L��(� �,�(� �,�4�T��!�;���	�-�)�	#rZc�j�|j�'|j|j|j�yy)zset the meta dataN)rr\r
)r�r^s  rXr\zIndexCol.write_metadata	s)���=�=�$��"�"�4�:�:�t�}�}�=�%rZ)
NNNNNNNNNNNNN)rdrbr
r�r�r�r�r�)rr�r�r��r&�objectr�rr�)rw�
np.ndarrayr_rbr�rbr�z3tuple[np.ndarray, np.ndarray] | tuple[Index, Index]rr\r�)r^�AppendableTabler�rr�r�)r�rr�r�)r^r�r�r�)"r�r�r�r�rr�rrhr�r�rrrr�r*r,r�r@rCrErIrLrOr
rTrVr_rYrZrprtr]r[r\r�rZrXrr�sq���!�O�T� �"��t�"�/�L�
�
�� �
��
�����
��)+��)+��
)+� 
�!)+�V�!��!��#��#�"�	
�
�&��?��?�0.� �0.�58�0.�BE�0.�	<�0.�d��#��#��&��&��;��;�����!�T�
���&�!�>&�7��">rZrc�B�eZdZdZedd��Z								dd�Zdd�Zy)	�GenericIndexColz:an index which is not represented in the data of the tablec��y�NFr�r�s rXr�zGenericIndexCol.is_indexed	���rZc��t|tj�sJt|���t	t|��}||fS)z�
        Convert the data from this selection to the appropriate pandas type.

        Parameters
        ----------
        values : np.ndarray
        nan_rep : str
        encoding : str
        errors : str
        )rSrTr6r�r0rm)r�rwr�r_r�r�s      rXr@zGenericIndexCol.convert!	s9���&�"�*�*�-�;�t�F�|�;�-��3�v�;�'���e�|�rZc��yr\r�r�s rXr]zGenericIndexCol.set_attr3	rWrZNr�)rwr�r_rbr�rbr�ztuple[Index, Index]r�)r�r�r�r�r�r�r@r]r�rZrXr�r�	sA��D�
����� ��58��BE��	��$
rZr�c�<��eZdZdZdZdZddgZ												d							d�fd�
Zedd��Z	edd��Z
dd�Zdd	�Zdd
�Z
d�Zedd��Zed
��Zedd��Zedd��Zed��Zed��Zed��Zed��Zdd�Zd d�Zdd�Z�xZS)!�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	rc
�V��t�|�|||||||||	|
|��||_|
|_y)N)rdrwr�rrr
r	rrvr�r)�superr�r7r�)r�rdrwr�rr
rr	rrvr�rr7r��	__class__s              �rXr�zDataCol.__init__H	sH��� 	��������������	�	
���
���	rZc� �|j�d�S)N�_dtypercr�s rX�
dtype_attrzDataCol.dtype_attrh	s���)�)��F�#�#rZc� �|j�d�S)N�_metarcr�s rX�	meta_attrzDataCol.meta_attrl	rrZc
��ttt|j|j|j
|j|jf��}djtgd�|�D��cgc]\}}|�d|����c}}�Scc}}w)Nr)rdr
r7r��shaper)
rkrr@rdr
r7r�r�rrHrs    rXr�zDataCol.__repr__p	s������t�y�y�$�*�*�d�j�j�$�)�)�T�Z�Z�X�
�
��
�x�x�#&�&Q�SW�"X�
�"X�J�C���%�r�%��!�"X�
�
�	
��
r c�0���t��fd�dD��S)r"c3�T�K�|]}t�|d�t�|d�k(���!y�wr\r$r%s  ��rXrjz!DataCol.__eq__.<locals>.<genexpr>	s0�����
�6��
�D�!�T�"�g�e�Q��&=�=�6�r')rdr
r7rr(r)s``rXr*zDataCol.__eq__}	s����
�6�
�
�	
rZc��|�J�|j�J�t|�\}}||_||_t|�|_yr\)r7�_get_data_and_dtype_namer��_dtype_to_kindr�)r�r��
dtype_names   rX�set_datazDataCol.set_data�	sG�������z�z�!�!�!�3�D�9���j���	���
�"�:�.��	rZc��|jS)zreturn the data�r�r�s rXrCzDataCol.take_data�	s���y�y�rZc��|j}|j}|j}|jdk(rd|jf}t|t�r5|j}|j||jj��}|Stj|d�st|t�r|j|�}|Stj|d�r|j|�}|St|�r t!�j#||d��}|St%|�r|j'||�}|S|j||j��}|S)zW
        Get an appropriately typed and shaped pytables.Col object for values.
        rg�r�r0�mr�rr�)r7rr�rp�sizerSr5�codes�
get_atom_datardrr:r'�get_atom_datetime64�get_atom_timedelta64r"r��
ComplexColr$�get_atom_string)r�rwr7rr�r��atoms       rX�	_get_atomzDataCol._get_atom�	s<��
�����>�>�������;�;�!������$�E��f�k�*��L�L�E��$�$�U����1A�1A�$�B�D����_�_�U�C�
(�J�u�o�,N��*�*�5�1�D����_�_�U�C�
(��+�+�E�2�D����e�
$��9�'�'���q��'�J�D����U�
#��&�&�u�h�7�D����$�$�U����$�<�D��rZc�>�t�j||d��S)Nrr��r�rS�r�r�rs   rXr�zDataCol.get_atom_string�	s���y�"�"�H�E�!�H�"�E�ErZc��|jd�r|dd}d|�d�}n)|jd�rd}n|j�}|�d�}tt�|�S)z0return the PyTables column class for this column�uint�N�UIntrE�period�Int64Col)r��
capitalizer�r�)r�r��k4�col_name�kcaps     rX�get_atom_coltypezDataCol.get_atom_coltype�	s_���?�?�6�"��a�b��B��b�T��~�H�
�_�_�X�
&�!�H��?�?�$�D���s�|�H��w�y�(�+�+rZc�:�|j|��|d��S)Nr�r�r��r��r�r�r�s   rXr�zDataCol.get_atom_data�	s!��.�s�#�#��#�.�U�1�X�>�>rZc�<�t�j|d��S�Nrr��r�r��r�r�s  rXr�zDataCol.get_atom_datetime64�	����y�!�!��a��!�1�1rZc�<�t�j|d��Sr�r�r�s  rXr�zDataCol.get_atom_timedelta64�	r�rZc�0�t|jdd�S)Nr�)r�r�r�s rXr�z
DataCol.shape�	s���t�y�y�'�4�0�0rZc��|jSrNr�r�s rXrOzDataCol.cvalues�	s���y�y�rZc��|r�t|j|jd�}|�#|t|j�k7rtd��t|j|jd�}|�||jk7rtd��yyy)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�rErrjrwr�r�r7)r�r��existing_fields�existing_dtypes    rXrZzDataCol.validate_attr�	s����%�d�j�j�$�.�.�$�G�O��*��$�t�{�{�BS�/S� �!W�X�X�$�T�Z�Z����$�G�N��)�n��
�
�.J� �V���/K�)�
rZc	���t|tj�sJt|���|jj
�||j}|j�J�|j�t|�\}}t|�}n|}|j}|j}t|tj�sJ�t|j�}|j}	|j}
|j}|�J�t|�}|j!d�rt#||d��}�n |dk(rtj$|d��}�n|dk(r>	tj$|D�
cgc]}
t'j(|
���c}
t*��}n�|dk(r�|	}|j1�}|�t3gtj4��}n\t7|�}|j9�rA||}||d	k7xx|j;t<�j?�j@zcc<tCjD|||
d
��}n	|j;|d
��}t|�dk(rtI||||��}|jJ|fScc}
w#t,$rEtj$|D�
cgc]}
t'j.|
���ncc}
wc}
t*��}Y�}wxYw#tF$r|j;d
d
��}Y��wxYw)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
        �
datetime64T��coerce�timedelta64�m8[ns]�r7rrw���F)�
categoriesr�validate�r��OrR�r�r_r�)&rSrTr6r�r7r8r
rr�r�r�rYr�rrr	r�r;�asarrayr�fromordinalr�r��
fromtimestamp�ravelr-�float64r4�any�astyper��cumsum�_valuesr5�
from_codesr��_unconvert_string_arrayrw)r�rwr�r_r��	convertedr�r�r�rrr	r7r~r�r��masks                 rXr@zDataCol.convert�	s��� �&�"�*�*�-�;�t�F�|�;�-��<�<���*��D�J�J�'�F��x�x�#�#�#��:�:��%=�V�$D�!�I�z�!�*�-�D��I����J��9�9�D��)�R�Z�Z�0�0�0��t�y�y�)���=�=���,�,��
�W�W���%�%�%��
�+�����L�)��	�2�d�;�I�
�m�
#��
�
�9�H�=�I�
�f�_�
��J�J�2;�<�)�Q�T�%�%�a�(�)�<�F��	��Z�
�!�J��O�O�%�E�
�!�
#�2�R�Z�Z�8�
��J�'���8�8�:�!+�T�E�!2�J��%�2�+�&�$�+�+�c�*:�*A�*A�*C�*K�*K�K�&�#�.�.��*�g���I�

>�%�,�,�U��,�?�	�
�4� �H�,�/��7�X�f��I��{�{�I�%�%��W=���
��J�J�4=�>�I�q�T�'�'��*�I��>�f��	�
��@�
>�%�,�,�S�u�,�=�	�
>�sB�I3�I.�6
I3�0K�.I3�3K�J,
�+K�K�K#�"K#c�"�t|j|j|j�t|j|j|j
�|j�J�t|j|j|j�y)zset the data for this columnN)rlrErrwr�r�r7r�r�s rXr]zDataCol.set_attrK
sZ����
�
�D�N�N�D�K�K�8���
�
�D�N�N�D�I�I�6��z�z�%�%�%���
�
�D�O�O�T�Z�Z�8rZ)NNNNNNNNNNNN)rdrbr
r�r7zDtypeArg | Noner�r�r�r)r�rIr�r�)rwrIr�rE)r�rbr�z	type[Col]�r�rbr�rEr�)rwr�r_rbr�rb)r�r�r�r�rrrhr�r�r�r�r�r*r�rC�classmethodr�r�r�r�r�r�r�rOrZr@r]�
__classcell__�r�s@rXr�r�7	s`���
��O����)�$�L�
�
�� �����
��!%�
�����
���
��@�$��$��#��#�
�
�/������>�F��F��,��,��?��?��2��2��2��2��1��1������b&�H9rZr�c�^�eZdZdZdZd	d�Zed��Zed
d��Zed��Z	ed��Z
y)�DataIndexableColz+represent a data column that can be indexedTc�j�tt|j�j�st	d��y)N�-cannot have non-object label DataIndexableCol)r$r-rwr7r�r�s rXrVzDataIndexableCol.validate_namesX
s*���u�T�[�[�1�7�7�8��L�M�M�9rZc�6�t�j|��S)N)rr�r�s   rXr�z DataIndexableCol.get_atom_string]
s���y�"�"�H�"�5�5rZc�0�|j|���S)Nr�r�r�s   rXr�zDataIndexableCol.get_atom_dataa
s��.�s�#�#��#�.�0�0rZc�2�t�j�Sr\r�r�s  rXr�z$DataIndexableCol.get_atom_datetime64e
����y�!�!�#�#rZc�2�t�j�Sr\r�r�s  rXr�z%DataIndexableCol.get_atom_timedelta64i
r�rZNr�r�)r�r�r�r�rrVr�r�r�r�r�r�rZrXr�r�S
sa��5���N�
�6��6��1��1��$��$��$��$rZr�c��eZdZdZy)�GenericDataIndexableColz(represent a generic pytables data columnN)r�r�r�r�r�rZrXr�r�n
s��2rZr�c���eZdZUdZded<dZded<ded<ded	<d
ed<dZd
ed<		d)									d*d�Zed+d��Z	ed,d��Z
ed��Zd-d�Zd.d�Z
d/d�Zed��Zed��Zed��Zed��Zed0d��Zed+d��Zed��Zd.d�Zd.d�Zed��Zed+d ��Zed!��Zd1d"�Zd2d.d$�Zd+d%�Z				d3			d4d&�Zd.d'�Z	d5					d6d(�Z y#)7�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.
    rb�pandas_kindru�format_type�type[DataFrame | Series]�obj_typer�rpr�r�FrrIc���t|t�sJt|���t�J�t|tj�sJt|���||_||_t|�|_||_	yr\)
rSr�r�r�rGr�r�r`r_r�)r�r�r�r_r�s     rXr�zFixed.__init__�
sg���&�(�+�9�T�&�\�9�+��%�%�%��%����1�>�4��;�>�1������
�(��2��
���rZc�v�|jddkxr&|jddkxr|jddkS)Nrrg�
�)�versionr�s rX�is_old_versionzFixed.is_old_version�
s:���|�|�A��!�#�U����Q��2�(=�U�$�,�,�q�/�TU�BU�UrZc���tt|jjdd��}	t	d�|jd�D��}t
|�dk(r|dz}|S#t$rd}Y|SwxYw)zcompute and set our version�pandas_versionNc3�2K�|]}t|����y�wr\)r�)rhrOs  rXrjz Fixed.version.<locals>.<genexpr>�
s����?�,>�q�C��F�,>�s��.r�)r)rrr)rYr�r�r�rkr�rmr�)r�r�s  rXr�z
Fixed.version�
sx��"�'�$�*�*�*=�*=�?O�QU�"V�W��	 ��?�G�M�M�#�,>�?�?�G��7�|�q� �!�D�.������	 ��G���	 �s�4A"�"A1�0A1c�V�tt|jjdd��S)Nr�)rYr�r�r�r�s rXr�zFixed.pandas_type�
s ���w�t�z�z�':�':�M�4�P�Q�QrZc��|j�|j}|�Wt|ttf�r.dj|D�cgc]
}t
|���c}�}d|�d�}|jd�d|�d�S|jScc}w)�(return a pretty representation of myselfr�[r=�12.12z	 (shape->�))r.r�rSrjrkrr@r�)r�rWrO�jshapes    rXr�zFixed.__repr__�
s��������J�J���=��!�d�E�]�+����A�">�A�q�<��?�A�">�?����x�q�M���&�&�u�-�Y�q�c��;�;������#?s�Bc��t|j�|j_tt�|j_y)zset my pandas type & versionN)rbr�rEr��_versionrr�s rXr�zFixed.set_object_info�
s)��!$�T�%5�%5�!6��
�
��$'��M��
�
�!rZc�0�tj|�}|Sr\r�)r��new_selfs  rXr�z
Fixed.copy�
s���9�9�T�?���rZc��|jSr\)r,r�s rXr�zFixed.shape�
r�rZc�.�|jjSr\�r�r�r�s rXrJzFixed.pathname�
rJrZc�.�|jjSr\)r�r�r�s rXr�z
Fixed._handle�
s���{�{�"�"�"rZc�.�|jjSr\)r�r�r�s rXr�zFixed._filters�
s���{�{�#�#�#rZc�.�|jjSr\)r�r�r�s rXr�zFixed._complevel�
s���{�{�%�%�%rZc�.�|jjSr\)r�r�r�s rXr�zFixed._fletcher32�
s���{�{�&�&�&rZc�.�|jjSr\)r�r�r�s rXrEzFixed.attrs�
rFrZc��y�zset our object attributesNr�r�s rX�	set_attrszFixed.set_attrs�
��rZc��y)zget our object attributesNr�r�s rX�	get_attrszFixed.get_attrs�
rrZc��|jS)zreturn my storable�r�r�s rX�storablezFixed.storable�
s���z�z�rZc��yr�r�r�s rXr�zFixed.is_exists�
r�rZc�0�t|jdd�S)Nr,)r�rr�s rXr,zFixed.nrows�
s���t�}�}�g�t�4�4rZc�
�|�yy)z%validate against an existing storableNTr�r)s  rXr�zFixed.validate�
s
���=��rZNc��y)�+are we trying to operate on an old version?Nr�)r�rns  rX�validate_versionzFixed.validate_version�
rrZc�B�|j}|�y|j�y)zr
        infer the axes of my storer
        return a boolean indicating if we have a valid storer or not
        FT)rr)r�rWs  rXr.zFixed.infer_axes�
s"��

�M�M���9������rZc��td��)Nz>cannot read on an abstract storer: subclasses should implement�r��r�rnr�r�r�s     rXr&z
Fixed.reads��"�L�
�	
rZc��td��)Nz?cannot write on an abstract storer: subclasses should implementr(�r�r�r�s   rXr�zFixed.writes��!�M�
�	
rZc��tj|||�r(|jj|jd��ytd��)zs
        support fully deleting the node in its entirety (only) - where
        specification must be None
        TrXNz#cannot delete on an abstract storer)r]r^r�r�r�r�)r�rnr�r�s    rXr_zFixed.deletes>���<�<��u�d�+��L�L�$�$�T�Z�Z�4�$�@���=�>�>rZ)rQr)
r�r�r�rGr_r�r�rbr�r�r�)r�ztuple[int, int, int]r�r�)r�r�r�)r�zLiteral[True] | Noner\�NNNN�r�r�r�r�r�)r�r�r�r�r�r�)!r�r�r�r�r�r�rIr�r�r�r�r�r�r�r�r�rJr�r�r�r�rErrrr�r,r�r%r.r&r�r_r�rZrXr�r�r
s���
����K���&�&�

�I����H�d�� '��
��
��
��	
�
�
�
�

��V��V��	��	��R��R�	 �2�
������&��&��#��#��$��$��&��&��'��'��#��#�(�(����������5��5��:�	��� ��	
��		
�
�	
�
�HL�?�!+�?�:D�?�	
�?rZr�c�V�eZdZUdZedediZej�D���cic]\}}||��
c}}}ZgZ	de
d<dd�Zd�Zd�Z
dd	�Zedd
��Zdd�Zdd�Zdd
�Zddd�Z	d							dd�Zdd�Zdd�Z	d							dd�Z	d							d d�Zd!d�Z	d"							d#d�Zycc}}}w)$�GenericFixedza generified fixed version�datetimer�r��
attributesc�:�|jj|d�S)N�)�_index_type_mapr�)r�r�s  rX�_class_to_aliaszGenericFixed._class_to_alias&s���#�#�'�'��R�0�0rZc�f�t|t�r|S|jj|t�Sr\)rSr��_reverse_index_mapr�r-)r��aliass  rX�_alias_to_classzGenericFixed._alias_to_class)s*���e�T�"��L��&�&�*�*�5�%�8�8rZc	�R�|jtt|dd���}|tk(rdd�}|}n|tk(rdd�}|}n|}i}d|vr|d|d<|t
urt}d|vr=t|dt�r|djd�|d<n|d|d<|tusJ�||fS)	N�index_classr4c���tj|j|j|��}t	j|d��}|� |jd�j
|�}|S)N)r7rrc�UTC)r6�_simple_newrwr7r,�tz_localize�
tz_convert)rwrr	�dta�results     rXrwz*GenericFixed._get_index_factory.<locals>.f8sZ��#�/�/��M�M����D���'�2�2�3�T�B���>�#�/�/��6�A�A�"�E�F��
rZc�t�t|�}tj||��}tj|d��S)Nr�rc)r)r7r?r/)rwrr	r7�parrs     rXrwz*GenericFixed._get_index_factory.<locals>.fEs1��#�D�)��"�.�.�v�U�C��"�.�.�t�$�?�?rZrr	zutf-8r�)
r:rYr�r,r/r-r2rS�bytesrV)r�rEr<rwr=r�s      rX�_get_index_factoryzGenericFixed._get_index_factory/s����*�*��G�E�=�"�=�>�
���-�'�
��G�
�K�
'�
@�
�G�!�G����U�?�"�6�]�F�6�N��e�#�(���5�=��%��+�u�-�$�T�{�1�1�'�:��t�� %�T�{��t���-�/�/�/����rZc�8�|�td��|�td��y)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�rns   rX�
validate_readzGenericFixed.validate_read`s=�����T��
����Y��
�rZc��y)NTr�r�s rXr�zGenericFixed.is_existsos��rZc�p�|j|j_|j|j_yr)r_rEr�r�s rXrzGenericFixed.set_attrsss"��"�m�m��
�
�� �K�K��
�
�rZc��tt|jdd��|_t	t|jdd��|_|jD]-}t||t	t|j|d����/y)�retrieve our attributesr_Nr�r)r`r�rEr_rYr�r2rl)r�r	s  rXrzGenericFixed.get_attrsxs`��(�����Z��)N�O��
�%�g�d�j�j�(�H�&M�N������A��D�!�_�W�T�Z�Z��D�-I�J�K�!rZc�$�|j�yr\)rr+s   rXr�zGenericFixed.writes�����rZNc���ddl}t|j|�}|j}t|dd�}t	||j
�r	|d||}n�t
t|dd��}	t|dd�}
|
�tj|
|	��}n|||}|	r-|	jd�rt|d	d�}t||d
��}n|	dk(rtj|d
��}|r|jS|S)z2read an array for the specified node (off of grouprN�
transposedF�
value_typer�r�r�r	Tr�r�r�)
r�r�r�r�rS�VLArrayrYrTr�r�r;r��T)r�r�r�r�r�r�rErP�retr7r�r	s            rX�
read_arrayzGenericFixed.read_array�s�����t�z�z�3�'���
�
���U�L�%�8�
��d�F�N�N�+��q�'�%��%�C�#�G�E�<��$F�G�E��E�7�D�1�E�� ��h�h�u�E�2���5��&����)�)�,�7��U�D�$�/���c�2�d�3���-�'��j�j��H�5����5�5�L��JrZc��tt|j|�d���}|dk(r|j|||��S|dk(r,t|j|�}|j|||��}|St
d|����)N�_variety�multi�r�r��regularzunrecognized index variety: )rYr�rE�read_multi_indexr��read_index_noder�)r�r�r�r��varietyr�r�s       rX�
read_indexzGenericFixed.read_index�s���"�'�$�*�*���X�6F�"G�H���g���(�(��E��(�E�E�
�	�
!��4�:�:�s�+�D��(�(��U��(�F�E��L��:�7�)�D�E�ErZc�4�t|t�r-t|j|�d�d�|j	||�yt|j|�d�d�td||j|j�}|j||j�t|j|�}|j|j_|j|j_t|tt f�r)|j#t%|��|j_t|tt t(f�r|j*|j_t|t�r2|j,�%t/|j,�|j_yyy)NrWrXrZr�)rSr.rlrE�write_multi_index�_convert_indexr_r��write_arrayrwr�r�r�r�rdr,r/r6r�r<r2rr	�_get_tz)r�r�r�r�r�s     rX�write_indexzGenericFixed.write_index�s$���e�Z�(��D�J�J�3�%�x� 0�'�:��"�"�3��.��D�J�J�3�%�x� 0�)�<�&�w��t�}�}�d�k�k�R�I����S�)�"2�"2�3��4�:�:�s�+�D�!*���D�M�M��!&���D�M�M���%�-��!=�>�,0�,@�,@��e��,M��
�
�)��%�-��n�!M�N�%*�Z�Z��
�
�"��%��/�E�H�H�4H�#*�5�8�8�#4��
�
� �5I�/rZc��t|j|�d�|j�tt	|j
|j|j��D]�\}\}}}t|jt�rtd��|�d|��}t|||j|j�}|j||j �t#|j$|�}	|j&|	j(_||	j(_t|	j(|�d|��|�|�d|��}
|j|
|���y)N�_nlevelsz=Saving a MultiIndex with an extension dtype is not supported.�_level�_name�_label)rlrEr��	enumeraterH�levelsr��namesrSr7r(r�rar_r�rbrwr�r�r�r�rd)r�r�r��i�lev�level_codesrd�	level_key�
conv_levelr��	label_keys           rXr`zGenericFixed.write_multi_index�s����
�
�s�e�8�,�e�m�m�<�+4�����e�k�k�5�;�;�7�,
�'�A�'��[�$��#�)�)�^�4�)�S����%�v�a�S�)�I�'�	�3��
�
�t�{�{�S�J����Y�
�(9�(9�:��4�:�:�y�1�D�!+���D�M�M��!%�D�M�M��
�D�M�M�c�U�%��v�#6��=��%�v�a�S�)�I����Y��4�),
rZc��t|j|�d��}g}g}g}t|�D]�}|�d|��}	t|j|	�}
|j	|
||��}|j|�|j|j�|�d|��}|j|||��}
|j|
���t|||d��S)NrfrgrYriT)rkr�rlrA)	r�rEror�r\r�rdrUr.)r�r�r�r�r�rkr�rlrmrpr�rnrrros              rXr[zGenericFixed.read_multi_index�s����$�*�*���X�&6�7������ "���w��A��%�v�a�S�)�I��4�:�:�y�1�D��&�&�t�5�t�&�D�C��M�M�#���L�L����"��%�v�a�S�)�I��/�/�)�5�t�/�L�K��L�L��%� ����e�d�
�	
rZc��|||}d|jvrktj|jj�dk(r?tj|jj|jj
��}t
|jj�}d}d|jvr*t|jj�}t
|�}|j}|j|�\}}	|dvr1|t|||j|j��fdti|	��}
n*|t|||j|j��fi|	��}
||
_	|
S)Nr�rr�rd)rr�r�r7)r�rT�prodr�r�rQrYr�rerdrG�_unconvert_indexr_r�r�)r�r�r�r�r�r�rdrEr=r�r�s           rXr\zGenericFixed.read_index_node�s9���E�$����d�m�m�#�����
�
�0C�0C�(D��(I��8�8�D�M�M�/�/�t�}�}�7O�7O�P�D��t�}�}�1�1�2�����T�]�]�"��t�}�}�1�1�2�D�"�4�(�D��
�
���1�1�%�8�����%�%�� ��$����t�{�{����	�
��E�� ��$����t�{�{����	�E���
��rZc�@�tjd|jz�}|jj	|j
||�t
|j
|�}t|j�|j_
|j|j_y)zwrite a 0-len array)rgN)rTr�rpr��create_arrayr�r�rbr7r�rQr�)r�r�r��arrr�s     rX�write_array_emptyzGenericFixed.write_array_emptysj���h�h�t�e�j�j�(�)�����!�!�$�*�*�c�3�7��t�z�z�3�'��#&�u�{�{�#3��
�
� �#�k�k��
�
�rZc�j�t|d��}||jvr&|jj|j|�|jdk(}d}t|jt�rtd��|st|d�r|j}d}d}|j�Ett�5t�jj!|j�}ddd�|�[|sE|jj#|j|||j$|j��}||dd�n�|j'||��n�|jj(t*j,k(r�t/j0|d��}	|rn6|	d	k(rn0t2|	||fz}
t5j6|
t8t;��
�|jj=|j|t�j?��}|jA|��n�t/jB|jd�rp|jjE|j||jGd��tI|j�tK|j|�jL_'�ngt|jtP�r�|jjE|j||jR�tK|j|�}tU|jV�|jL_+d
|jjX�d�|jL_'n�t/jB|jd�r\|jjE|j||jGd��dtK|j|�jL_'n<|r|j'||�n'|jjE|j||�|tK|j|�jL_-y#1swY��KxYw)NT)�
extract_numpyrFz]Cannot store a category dtype in a HDF5 dataset that uses format="fixed". Use format="table".rS)r���skipnarRrfr0r1�datetime64[r=r�r�).r:r�r�r�r�rSr7r&r�r.rSr�rr�r��Atom�
from_dtype�
create_carrayr�rzr�rT�object_r�infer_dtypertrjrkrr�create_vlarray�
ObjectAtomr�r:rx�viewrbr�r�rQr'�asi8rcr	�unitrP)
r�r�r�rr��empty_arrayrPr��ca�
inferred_typero�vlarrr�s
             rXrbzGenericFixed.write_array(s���c��6���$�*�*���L�L�$�$�T�Z�Z��5��j�j�A�o���
��e�k�k�#3�4�%�/��
���u�c�"�����!�
����=�=�$��*�%��y�~�~�0�0����=��&���
��\�\�/�/��J�J��T�5�;�;��
�
�0�����1���&�&�s�E�2�
�[�[�
�
����
+� �O�O�E�%�@�M����(�*��$�
�s�E�'B�B���
�
�b�"4�AQ�AS�T��L�L�/�/��
�
�C���AU�AU�AW�X�E��L�L���
�_�_�U�[�[�#�
.��L�L�%�%�d�j�j�#�u�z�z�$�7G�H�;>�u�{�{�;K�G�D�J�J��$�-�-�8�
����_�
5�
�L�L�%�%��
�
�C����
��4�:�:�s�+�D� '�u�x�x�0�D�M�M��)4�U�[�[�5E�5E�4F�a�'H�D�M�M�$�
�_�_�U�[�[�#�
.��L�L�%�%�d�j�j�#�u�z�z�$�7G�H�;H�G�D�J�J��$�-�-�8�
��"�"�3��.��L�L�%�%�d�j�j�#�u�=�7A���
�
�C� �)�)�4�w&�%�s�1.P(�(P2r�r�r�r�r�)r�rbr�r�r�r�r�r-)r�rbr�r-r�r�)r�rbr�r.r�r�)r�rbr�r�r�r�r�r.)r�rGr�r�r�r�r�r-)r�rbr�rIr�r�r\)r�rbr�rHrzIndex | Noner�r�)r�r�r�r�r,r/r5rr8r2r�r6r:rGrIr�r�rrr�rUr^rdr`r[r\rzrb)rhrNr~s000rXr0r0sZ��$�$�j�+�x�H�O�+:�+@�+@�+B�C�+B�4�1�a�!�Q�$�+B�C���J�	��1�9�/�b
�����(�
L�� �FFJ�F��F�)�F�8B�F�	�F�5�.5�4FJ�
��
�)�
�8B�
�	�
�0HL�$��$�!+�$�:D�$�	�$�L*�BF�XB��XB�)�XB�2>�XB�	
�XB��MDs�
B$r0c�b��eZdZUdZdgZded<ed��Z				d					dd�Zd	�fd�Z	�xZ
S)
r�r�rdrAc�n�	t|jj�fS#ttf$rYywxYwr\)rmr�rwr�r�r�s rXr�zSeriesFixed.shape�s6��	���
�
�)�)�*�,�,���>�*�	��	�s�"�4�4c��|j||�|jd||��}|jd||��}t|||jd��}t�rt
|d��r|jd�}|S)	Nr�rYrwF)r�rdr�Tr}�string[pyarrow_numpy])rIr^rUr1rdrrr�)r�rnr�r�r�r�rwrCs        rXr&zSeriesFixed.read�ss��	
���7�E�*�����u�4��@�������T��B����e�$�)�)�%�H��%�'�O�F�4�,P��]�]�#:�;�F��
rZc���t�|�|fi|��|jd|j�|j	d|�|j
|j_y)Nr�rw)r�r�rdr�rbrdrE)r�r�r�r�s   �rXr�zSeriesFixed.write�sG���
��
�c�$�V�$�����#�)�)�,�����3�'��(�(��
�
�rZr-�r�r�r�r�r�r1r�)r�r�r�r�r2r�r�r�r&r�r�r�s@rXr�r��sa����K���J�
�N�
������ ��
��	
�
�
�
�

�#�#rZr�c�b��eZdZUddgZded<edd��Z				d					d	d�Zd
�fd�Z�xZ	S)�BlockManagerFixedrp�nblocksr�c�n�	|j}d}t|j�D]4}t|jd|�d��}t|dd�}|��-||dz
}�6|jj
}t|dd�}|�t
|d|dz
�}ng}|j|�|S#t$rYywxYw)Nr�block�_itemsr�rg)	rpror�r�r��
block0_valuesrjr�r�)r�rprrmr�r�s      rXr�zBlockManagerFixed.shape�s���	��9�9�D��E��4�<�<�(���t�z�z�U�1�#�V�+<�=����g�t�4���$��U�1�X�%�E�	)��:�:�+�+�D��D�'�4�0�E�� ��U�1��q��2�3�����L�L����L���	��	�s�AB(�AB(�(	B4�3B4c�2�|j||�|j�jd�}g}t|j�D]8}||k(r||fnd\}}	|jd|��||	��}
|j
|
��:|d}g}t|j�D]�}|jd|�d��}
|jd|�d�	��}||j|
�}t|j||dd	�
�}t�rt|d��r|jd
�}|j
|���t|�dkDr=t!|dd��}t#�r|j%�}|j'|d	��}|St|d|d��S)Nrr�r@rYr�r�r�rgF�r�r�r�Tr}r�)r@r�)r�r��r�r�)rIr��_get_block_manager_axisrorpr^r�r�rUrur+rSrrr�rmr3rr�rz)r�rnr�r�r��select_axisrbrmr'r(�axr�dfs�	blk_itemsrw�df�outs                 rXr&zBlockManagerFixed.read�s���	
���7�E�*��m�m�o�=�=�a�@�����t�y�y�!�A�-.�+�-=�U�D�M�<�M�F�E����4��s��6���F�B��K�K��O�"�
�Q������t�|�|�$�A����%��s�&�(9�:�I��_�_�u�Q�C�w�%7�v�E�_�R�F��E�-�-�i�8�9�G��6�8�8�W�D��G�%�P�B�)�+���t�0T��Y�Y�6�7���J�J�r�N�%��s�8�a�<���1�4�0�C�"�$��h�h�j���+�+�e�%�+�8�C��J���a���Q��8�8rZc����t�|�|fi|��t|jt�r|jd�}|j}|j
�s|j�}|j|j_t|j�D]6\}}|dk(r|jstd��|jd|��|��8t|j �|j_t|j �D]b\}}|j$j'|j(�}|j+d|�d�|j,|��|jd|�d�|��dy)Nr�rz/Columns index has to be unique for fixed formatr@r�)rr�)r�r�rS�_mgrr<�_as_manager�is_consolidated�consolidaterprErjrb�	is_uniquer�rdrm�blocksr�rrv�mgr_locsrbrw)	r�r�r�r�rmr��blkr�r�s	        �rXr�zBlockManagerFixed.write�s)���
��
�c�$�V�$��c�h�h��-��/�/�'�*�C��x�x���#�#�%��#�#�%�D��)�)��
�
���t�y�y�)�E�A�r��A�v�r�|�|� �!R�S�S����t�A�3�Z��,�*�!����-��
�
������,�F�A�s��
�
������5�I����u�Q�C�w�/����9��M����u�Q�C�v�.�	�:�	-rZ)r�zShape | Noner-)r�r�r�r�r�r+r�)
r�r�r�r2r�r�r�r&r�r�r�s@rXr�r��s`����)�$�J�
�L�
����8�� ��'9��	'9�
�'9�
�
'9�R;�;rZr�c��eZdZdZeZy)r�r�N)r�r�r�r�r+r�r�rZrXr�r�	
s���K��HrZr�c���eZdZUdZdZdZded<ded<dZded	<d
Zded<								d3																			d4�fd
�
Z	e
d5d��Zd5d�Zd6d�Z
d7d�Ze
d8d��Z				d9d�Ze
d:d��Ze
d8d��Ze
d��Ze
d��Ze
d��Ze
d��Ze
d;d��Ze
d:d��Ze
d8d��Ze
d<d��Zd=d�Zd�Zd>d �Zd?d!�Zd@d"�ZdAd#�Z d7d$�Z!d7d%�Z"dBd7d&�Z#d7d'�Z$e%d(��Z&	dC			dDd)�Z'	dE					dFd*�Z(e)dGd+��Z*d,�Z+				dH			dId-�Z,e-				dJd.��Z.dBdKd/�Z/								dLd0�Z0	dC			dMd1�Z1			dC					dNd2�Z2�xZ3S)Oraa
    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_tablervrbr�r�rgzint | list[Hashable]rkTrjrc���t�|�||||��|xsg|_|xsg|_|xsg|_|xsg|_|	xsi|_|
|_y)Nr�)r�r��
index_axesrK�values_axesr�r�r�)r�r�r�r_r�r�rKr�r�r�r�r�s           �rXr�zTable.__init__.
s`���	������&��I�$�*����,�2����&�,�"���(�.�B����J�B��	���rZc�>�|jjd�dS)N�_r)r�r�r�s rX�table_type_shortzTable.table_type_shortC
s�����$�$�S�)�!�,�,rZc
��|j�t|j�rdj|j�nd}d|�d�}d}|jr8dj|j
D�cgc]
}t
|���c}�}d|�d�}dj|jD�cgc]}|j��c}�}|jd�|�d|j�d	|j�d
|j�d|�d|�d�
Scc}wcc}w)
rrr4z,dc->[r=rrrz (typ->z,nrows->z,ncols->z,indexers->[r	)
r.rmr�rr�r�rbr�rdr�r�r,�ncols)r��jdcr��verrO�jverr��jindex_axess        rXr�zTable.__repr__G
s������-0��1B�1B�-C�c�h�h�t�(�(�)����c�U�!�_��������8�8�T�\�\�:�\��S��V�\�:�;�D��d�V�1�+�C��h�h����@��1�����@�A������&�s�e�,��*�*�+�8�D�J�J�<�@��j�j�\��k�]�!�B�4�q�
B�	
��	;�� As�0D�(Dc�L�|jD]}||jk(s�|cSy)zreturn the axis for cN)rbrd)r�rar�s   rXr�zTable.__getitem__Y
s%�����A��A�F�F�{����rZc�b�|�y|j|jk7r&td|j�d|j�d���dD]h}t||d�}t||d�}||k7s�#t|�D]$\}}||}||k7s�t	d|�d|�d|�d���td|�d|�d|�d���y)	z"validate against an existing tableNz'incompatible table_type with existing [rcr=)r�rKr�zinvalid combination of [z] on appending data [z] vs current table [)r�r�r�rjr�r[)r�r&ra�sv�ovrm�sax�oaxs        rXr�zTable.validate`
s����=�����t���.����$�$�%�S����(9��<��
�
A�A���q�$�'�B����4�(�B��R�x�(��m�F�A�s��Q�%�C��c�z�(�6�q�c�: � #�u�$8���Q�@���	,� �.�q�c�1F�r�d�K&�&(�T��,���#ArZc�6�t|jt�S)z@the levels attribute is 1 or a list in the case of a multi-index)rSrkrjr�s rX�is_multi_indexzTable.is_multi_index�
s���$�+�+�t�,�,rZc���tj|jj�}	|j	�}t
|t�sJ�||fS#t
$r}td�|�d}~wwxYw)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�rl�reset_indexr�rSr+)r�r�rk�	reset_objr`s     rX�validate_multiindexzTable.validate_multiindex�
so���'�'��	�	���8��	����)�I�
�)�Y�/�/�/��&� � ���	��T���
��	�s�A�	A+�A&�&A+c��tj|jD�cgc]}|jjd��c}�Scc}w)z-based on our axes, compute the expected nrowsr)rTrur�rOr��r�rms  rX�nrows_expectedzTable.nrows_expected�
s6���w�w�D�O�O�D�O�q��	�	����*�O�D�E�E��Ds� Ac��d|jvS)zhas this table been createdrvrr�s rXr�zTable.is_exists�
s���$�*�*�$�$rZc�0�t|jdd�S�Nrv�r�r�r�s rXrzTable.storable�
s���t�z�z�7�D�1�1rZc��|jS)z,return the table group (this is my storable))rr�s rXrvzTable.table�
s���}�}�rZc�.�|jjSr\)rvr7r�s rXr7zTable.dtype�
s���z�z���rZc�.�|jjSr\rHr�s rXrIzTable.description�
rJrZc�V�tj|j|j�Sr\)rFrGr�r�r�s rXrbz
Table.axes�
s�����t����0@�0@�A�ArZc�:�td�|jD��S)z.the number of total columns in the values axesc3�FK�|]}t|j����y�wr\)rmrw)rhr�s  rXrjzTable.ncols.<locals>.<genexpr>�
s����;�*:�Q�3�q�x�x�=�*:�s�!)�sumr�r�s rXr�zTable.ncols�
s���;�$�*:�*:�;�;�;rZc��yr�r�r�s rX�
is_transposedzTable.is_transposed�
r�rZc���ttj|jD�cgc]}t	|d���c}|j
D�cgc]}t	|j���c}��Scc}wcc}w)z@return a tuple of my permutated axes, non_indexable at the frontr)rkrFrGrKr�r�r@�r�r�s  rX�data_orientationzTable.data_orientation�
sc����O�O�$(�$7�$7�8�$7�q��Q�q�T��$7�8�&*�o�o�6�o���Q�V�V��o�6�
�
�	
��8��6s�A/�A4c�l�ddd�}|jD�cgc]}|j|f��}}|jD��cgc]\}}||df��}}}|jD�cgc]2}|jt|j�vs�%|j|f��4}}t||z|z�Scc}wcc}}wcc}w)z<return a dict of the kinds allowable columns for this objectr�r��rrgN)r�r
rKr�rdrnr�rl)	r��
axis_namesr��d1r@rw�d2r~�d3s	         rX�
queryableszTable.queryables�
s���!�Y�/�
�%)�O�O�
4�O�q�q�w�w��l�O��
4�;?�;N�;N�
O�;N�<�4��z�$���&�;N��
O�"&�"2�"2�
�"2�Q�a�f�f��D�DU�DU�@V�6V�Q�W�W�a�L�"2�	�
��B��G�b�L�!�!��
5��
O��
s�B&�B+�&B1�B1c�l�|jD�cgc]}|j|jf��c}Scc}w)zreturn a list of my index cols)r�r@r
r�s  rX�
index_colszTable.index_cols�
s-��,0�?�?�;�?�a�������!�?�;�;��;s�1c�T�|jD�cgc]}|j��c}Scc}w)zreturn a list of my values cols)r�r
r�s  rX�values_colszTable.values_cols�
s&��!%�!1�!1�2�!1�A����!1�2�2��2s�%c�>�|jj}|�d|�d�S)z)return the metadata pathname for this keyz/meta/z/metarr#s   rX�_get_metadata_pathzTable._get_metadata_path�
s$���
�
�&�&�����s�e�5�)�)rZc��|jj|j|�t|d��d|j|j
|j��y)z�
        Write out a metadata array to the key as a fixed-format Series.

        Parameters
        ----------
        key : str
        values : ndarray
        Fr�rv)r�r_r�r�N)r�r�r�r1r_r�r�)r�r�rws   rXr\zTable.write_metadata�
sI��	
������#�#�C�(��6��&���]�]��;�;��L�L�
	�	
rZc��tt|jdd�|d��*|jj|j	|��Sy)z'return the meta data array for this keyr�N)r�r�r�r�r�r�s  rXr{zTable.read_metadata�
sA���7�4�:�:�v�t�4�c�4�@�L��;�;�%�%�d�&=�&=�c�&B�C�C�rZc�B�t|j�|j_|j�|j_|j	�|j_|j
|j_|j|j_|j|j_|j|j_|j|j_	|j|j_
|j|j_y)zset our table type & indexablesN)rbr�rEr�r�rKr�r�r_r�rkr�r�s rXrzTable.set_attrs�
s��� #�D�O�O� 4��
�
�� $��� 1��
�
��!%�!1�!1�!3��
�
��$(�$7�$7��
�
�!�"&�"3�"3��
�
��!�\�\��
�
��"�m�m��
�
�� �K�K��
�
�� �K�K��
�
���)�)��
�
�rZc��t|jdd�xsg|_t|jdd�xsg|_t|jdd�xsi|_t|jdd�|_t
t|jdd��|_tt|jdd��|_	t|jd	d�xsg|_
|jD�cgc]}|js�|��c}|_
|jD�cgc]}|jr�|��c}|_ycc}wcc}w)
rMrKNr�r�r�r_r�rrk)r�rErKr�r�r�r`r_rYr�rk�
indexablesrr�r�r�s  rXrzTable.get_attrs
s���%�d�j�j�2B�D�I�O�R���#�D�J�J���E�K�����D�J�J���5�;���	��t�z�z�9�d�;���(�����Z��)N�O��
�%�g�d�j�j�(�H�&M�N���&-�d�j�j�(�D�&I�&O�R���&*�o�o�K�o���9J�9J�1�o�K���'+���P��!�a�>O�>O�A��P����L��Ps�5E�E�!E�3Ec	���|�k|jr^tdj|jD�cgc]
}t	|���c}�z}tj|tt���yyycc}w)r$Nrrf)	r�rrrr�rbrjrkrr)r�rnrOros    rXr%zTable.validate_versions`�����"�"�(�3�8�8�T�\�\�4R�\��S��V�\�4R�+S�S���
�
��*�/�1��#���4Rs�A/
c��|�yt|t�sy|j�}|D]}|dk(r�	||vs�td|�d���y)z�
        validate the min_itemsize doesn't contain items that are not in the
        axes this needs data_columns to be defined
        Nrwzmin_itemsize has the key [z%] which is not an axis or data_column)rSrlr�r�)r�r��qrNs    rX�validate_min_itemsizezTable.validate_min_itemsize!s_��
����,��-���O�O����A��H�}����z� �0���4"�"���rZc�`��
����g}�j��jj�t�jj�D]k\}\}}t�|�}�j
|�}|�dnd}|�d�}t�|d�}	t||||	|�j||��}
|j|
��mt�j��t|��
�
����fd�}|jt�jj�D��cgc]\}}|||���c}}�|Scc}}w)z/create/cache the indexables if they don't existNrwr)rdr@rr�rrvr�rc�f��t|t�sJ�t}|�vrt}t	�
|�}t|�j�}t	�|�d�d�}t	�|�d�d�}t|�}�j|�}t	�|�d�d�}	|||||�|z|�j|	||��
}
|
S)Nrr�r�)
rdr
rwr�rrrvr�rr7)
rSrbr�r�r��_maybe_adjust_namer�r�r{rv)rmra�klassr��adj_namerwr7r��mdr�r��base_posr��descr��table_attrss           �����rXrwzTable.indexables.<locals>.fYs�����a��%�%�%��E��B�w�(���4��#�D�)�!�T�\�\�:�H��[�X�J�e�*<�d�C�F��K�H�:�V�)<�d�C�E�"�%�(�D��#�#�A�&�B��;�8�*�E�(:�D�A�D�������q�L���j�j�����C��JrZ)rIrvrErjr�r�r{rr�rnr�rmrrr�)r��_indexablesrmr@rdr�r�r�rr��	index_colrwrar�r�r�r�s`            @@@@rXr�zTable.indexables6s+����������j�j�&�&��
 )����)>�)>�?�O�A�|��d��4��&�D��#�#�D�)�B�!#��:�T�D��&���I��;�	�4�8�D� �������j�j���	�I�
���y�)�% @�*��"�"�
#���{�#��!	�!	�J	���	�$�*�*�:P�:P�0Q�R�0Q���1�A�a��G�0Q�R�S����Ss�
D*
c
��|j�sy|dury|�|dur0|jD�cgc]}|js�|j��}}t	|t
tf�s|g}i}|�||d<|�||d<|j}|D]�}t|j|d�}|��|jr^|j}	|	j}
|	j}|�||k7r|j�n||d<|�|
|k7r|j�n|
|d<|jr��|jj!d�rt#d��|j$di|����||j&dd	vs��t)d
|�d|�d|�d
���ycc}w)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.
        NFTr�r��complexz�Columns 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.rrgzcolumn 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�)r.rbrr
rSrkrjrvr�rir�r�r�r��remove_indexr�r�r�r�rKr�)r�r�r�r�r��kwrvrar~r��cur_optlevel�cur_kinds            rXr�zTable.create_index�s���<��� ���e����?�g��o�(,�	�	�I�	�1�Q�5H�5H�q�w�w�	�G�I��'�E�4�=�1��i�G�
����%�B�z�N����B�v�J��
�
���A���
�
�A�t�,�A��}��<�<��G�G�E�#(�>�>�L�$�z�z�H��'�H��,<����(�%-��6�
��+���0H����(�)5��:���|�|��v�v�(�(��3�'�H���#�A�N�N�(�R�(��d�)�)�!�,�Q�/�/�$��a�S�!/�/0�c�21�12��3S�U���A��Js
�E<�E<c�(�t||||��}|j�}g}|jD]a}|j|j�|j||j|j|j��}|j|��c|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]]
        r3r�)
�	Selectionr�rbrtr�r@r�r_r�r�)	r�rnr�r��	selectionrwrr��ress	         rX�
_read_axeszTable._read_axes�s���"�d�%�u�4�H�	��!�!�#�������A�
�J�J�t�y�y�!��)�)���������{�{�	��C�
�N�N�3����rZc��|S)zreturn the data for this objr��r�r�rPs   rX�
get_objectzTable.get_object�s	���
rZc���t|�sgS|d\}}|jj|i�}|jd�dk(r|rtd|�d|����|durt	|�}n|�g}t|t�rLt|�}t	|�}|j|j�D�cgc]
}|dk7r||vr|��c}�|D�	cgc]	}	|	|vs�|	��c}	Scc}wcc}	w)zd
        take the input data_columns and min_itemize and create a data
        columns spec
        rr�r.z"cannot use a multi-index on axis [z] with data_columns Trw)
rmr�r�r�rjrSrlrnrrr
)
r�r�r�rKr@�axis_labelsr��existing_data_columnsrNras
          rX�validate_data_columnszTable.validate_data_columns�s��
�>�"��I�*�1�-���k��y�y�}�}�T�2�&���8�8�F��|�+���4�T�F�; � ,�~�/��
��4����,�L�
�
!��L��l�D�)�$'��$5�!���-�L����*�.�.�0��0���H�}��2G�)G��0��
�(�<�<�a�1��+;��<�<�<����=s�0C�
	C#�C#c�$��t|t�s1|jj}t	d|�dt|��d�����dg��D�cgc]}|j
|���c}�|j�rHd}	|jD�cgc]}|j��c}�t|j�}|j}nd}	|j}
|jdk(sJ�t��|jd	z
k7rt!d
��g}|�d}t#�fd�d
D��}|j$|}t|�}
|	r�t|�}|j&|d	}t)t+j,|
�t+j,|�dd��sIt)t+j,t/|
��t+j,t/|��dd��r|}
|
j1|i�}t|j2�|d<t|�j4|d<|j7||
f��d}|j$|}|j9|�}t;|||j<|j>�}||_	|jAd�|jC|
�|jE|�|g}t|�}|d	k(sJ�t|�d	k(sJ�|D]}tG||d|d	�}�|jd	k(}|jI|||�}|jK||�jM�}|jO||	||jP|�\}}g}tStU||��D�]�\}\}}tV}d}|r=t|�d	k(r/|d|vr(tX}|d}|�t|tZ�st!d��|	r|r	|jP|}nd}|xsd|��}!ta|!|jb||||j<|j>|��}"te|!|jf�}#|ji|"�}$tk|"jljn�}%d}&tq|"dd��ts|"jt�}&dx}'x}(})t|"jltv�r;|"jx})d}'t+jz|"j|�j�}(t�|"�\}*}+||#|!t|�|$||%|&|)|'|(|+|*��},|,jC|
�|j7|,�|d	z
}���|D�,cgc]},|,j�s�|,jn��}-},t|�|j�|j|j<|j>||||-|
|��
}.t�|d�r|j�|._D|.j�|�|r|	r|.j�|�|.Scc}wcc}w#t\t^f$r"} t!d|�d|jP�d��| �d} ~ wwxYwcc},w)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�r=NrTFr�rgz<currently only support ndim-1 indexers in an AppendableTable�nanc3�,�K�|]}|�vs�|���
y�wr\r�)rhrOrbs  �rXrjz%Table._create_axes.<locals>.<genexpr>ns�����6�f����
�1�f�s�	�r�rxrlr�r�zIncompatible appended table [z]with existing table [�
values_block_)�existing_colr�r�r_r�r�r	rw)rdr
rwrrr�r	rr�rr7r�)
r�r�r_r�r�rKr�r�r�r�rk)GrSr+r�r�r�r��_get_axis_numberr.r�r@rjr�r�r�rprmr�rmrbrKr*rT�arrayrtrirlr�r��_get_axis_namerar_r�rrprT�
_reindex_axisrrrB�_get_blocks_and_itemsr�rjrHr�r�rb�
IndexErrorr��_maybe_convert_for_string_atomrwr�r�r�r�r7rdr�rcr	r&rr�r�r�r�rr�r.rkr�r�)/r�rbr�r�r�r�r�r�r��table_exists�new_info�new_non_index_axesrm�append_axis�indexer�
exist_axisr��	axis_name�	new_index�new_index_axes�jrPr�r�r��vaxesrmr��b_itemsr�rdrr`�new_name�data_convertedr�rr�r	r�rrr�r�rL�dcs�	new_tables/ `                                             rX�_create_axeszTable._create_axes%s���@�#�y�)��J�J�&�&�E��A�%��I��s�)��A�'��
��<��3�D�26�6��A��$�$�Q�'��6���?�?���L�$(�O�O�4�O�q�A�F�F�O�4�D��� 1� 1�2�L��l�l�G�!�L��9�9���y�y�A�~��~��t�9��	�	�A�
�%��N��
�
$&���?��G��6�f�6�6���H�H�S�M���1�g����,�-�G��,�,�W�5�a�8�J�#�����%�����$�� �	�$��H�H�V�K�0�1��H�H�V�J�/�0�#� $�	�#-�K��"�"�3��+���Q�W�W�
��W�
��A�w�'�'��V���!�!�3��"4�5��1�g���H�H�S�M���&�&�s�+�	�"�9�a�������L�	��	��	���!�����h�'�� � ��.�#��������A�v�
�v��%�&�!�+�+�+�#�A���Q�q�T�1�Q�4�0�C�$��^�^�q�(�
��1�1��,�(:�
������Z�0�=�=�?�� �6�6��<�!3�T�5E�5E�|�
���	�
��!*�3�v�y�+A�!B��A�~��W��E��D���G��� 1�g�a�j�L�6P�(���q�z����
�4��(=�$�%T�U�U����#'�#3�#3�A�#6�L� $���2��q�c�2�H�;���
�
�)�)������{�{��	�N�*�(�D�L�L�A�H��/�/�.�1�C�!�.�"6�"6�";�";�<�D��B��~�t�T�2�>��^�.�.�/��(,�,�D�,�8�g��.�.�.�0@�A�(�0�0��!���:�:�n�&?�&?�@�F�F�H��7��G��D�*�����G�}�������!� ��
�C�
�O�O�H�%��L�L���
��F�A�S"C�V$)�B�5�C�C�,A�,A�s�x�x�5��B��D��J��;�;��*�*��]�]��;�;�%�-�����
�	��4��"�#�{�{�I���'�'��5������t�$����E7��
5��^#�H�-��$�7��x�@0�04�0@�0@�/A��D�������nCs0�W�W�;W�%X
�7X
�X
�(X�X
c
��t|jt�r|jd�}d�}|j}t	t
|�}t
|j�}||�}t|�r�|d\}	}
t|
�jt|��}|j||	��j}t	t
|�}t
|j�}||�}|D]b}|j|g|	��j}t	t
|�}|j|j�|j||���d|r�t||�D�
�cic]!\}
}t|j��|
|f��#}}
}g}g}|D]N}t|j �}	|j#|�\}
}|j%|
�|j%|��P|}|}||fScc}}
w#t&t(f$rC}dj+|D�cgc]
}t-|���ncc}wc}�}t/d|�d��|�d}~wwxYw)Nr�c��|jD�cgc]'}|jj|j���)c}Scc}wr\)r�rrvr�)�mgrr�s  rX�
get_blk_itemsz2Table._get_blocks_and_items.<locals>.get_blk_items#s/��<?�J�J�G�J�S�C�I�I�N�N�3�<�<�0�J�G�G��Gs�,>rrkrz+cannot match existing table structure for [z] on appending data)rSr�r<r�r
r=rjr�rmr-rsrzrrrHrk�tolistrwrLr�rr�rr@r�)r�rrr�r�r0r/r�r�r@r
�
new_labelsra�br'�by_items�
new_blocks�
new_blk_items�earr`�item�jitemss                       rXrzTable._get_blocks_and_itemss2���e�j�j�,�/��%�%�g�.�E�	H��j�j���<��%��"�3�:�:�.��!.�s�!3�	��|��
!3�1� 5��D�+��{�+�6�6�u�\�7J�K�J��-�-�
��-�6�;�;�C��|�S�)�C��#�*�*�%�F�%�c�*�I�!���m�m�Q�C�d�m�3�8�8���<��-���
�
�c�j�j�)�� � ��s�!3�4�"��#&�f�i�"8��"8�J�A�w��g�n�n�&�'�!�W��5�"8�
��')�J��M�!���b�i�i�(��	�!)���e�!4�J�A�w��%�%�a�(�!�(�(��1�"� �F�%�I��y� � ��+��#�H�-�� �X�X�e�&L�e�d�|�D�'9�e��&L�M�F�$�E�f�X�N,�,������s*� &G(�(6G.�.I�=H;�H�H;�;Ic����|�t|�}|�P�jrDt�jt�sJ��jD]}||vs�|j	d|���j
D]\}}t
�|||����fd�}�|j�-|jj�D]\}}	}
||
|	����S)zprocess axes filtersrc����jD]�}�j|�}�j|�}|�J�||k(rP�	jr$|j	t�	j��}|||�}�j|��|cS||vs��tt�|�j�}t|�}t�t�rd|z
}|||�}�j|��|cStd|�d���)Nrkrgzcannot find the field [z] for filtering!)�_AXIS_ORDERSr�	_get_axisr��unionr-rkryr;r�rwrSr+r�)
�field�filt�opr"�axis_number�axis_values�takersrwr�r�s
        ��rX�process_filterz*Table.process_axes.<locals>.process_filterjs���!$�!1�!1�I�"%�"6�"6�y�"A�K�"%�-�-�	�":�K�&�2�2�2��	�)� �.�.�#'�:�:�e�D�K�K�.@�#A�D�!#�K��!6��"�w�w�K�w�8��@�@��+�-�!-�g�c�5�.A�.H�.H�!I��+�D�1��&�c�9�5�*+�k�/�K�!#�F�D�!1��"�w�w�K�w�8��@�@�5"2�8!�#:�5�'�AQ�!R�S�SrZ)	rjr�rSrk�insertrKr�filterr�)r�r�rr�r	r@�labelsrEr?rAr@s``         rX�process_axeszTable.process_axesYs�������7�m�G���4�#6�#6��d�k�k�4�0�0�0��[�[���G�#��N�N�1�a�(�!�
!�/�/�L�D�&���T�6�7�;�C�
T�0�F���'�#,�#3�#3�#:�#:�#<���r�4�$�U�D�"�5��$=��
rZc�n�|�t|jd�}d|d�}|jD�cic]}|j|j��c}|d<|rC|�|j
xsd}t
�j|||xs|j��}||d<|S|j�|j|d<|Scc}w)z:create the description of the table from the axes & valuesi'rv)rdrcrI�	)r�r�r�r�)
�maxr�rbr
rr�r�rr�r�)r�r�r�r�rcr{r�r�s        rX�create_descriptionzTable.create_description�s������t�2�2�E�:�L��l�;��59�I�I�>�I�q�A�G�G�Q�U�U�N�I�>��-���� � �O�O�0�q�	��i�'�'�#��%�9��)9�)9�(��G�
#�A�i�L����]�]�
&��=�=�A�i�L����?s�B2c���|j|�|j�syt||||��}|j�}|j��|jj�D]m\}}}|j
||j�|j�dz��}	|||	j||j�z
|�j}�ot|�S)zf
        select coordinates (row numbers) from a table; return the
        coordinates object
        Fr3rgrY)r%r.r�
select_coordsrGr�r:r�rL�ilocrwr-)
r�rnr�r�r�coordsr?rAr@r�s
          rXr5zTable.read_coordinates�s���	
���e�$���� ���d�%�u�4�H�	��(�(�*�����'�#,�#3�#3�#:�#:�#<���r�4��'�'������F�J�J�L�1�4D�(��� ��4�9�9�V�f�j�j�l�-B�#C�T� J� Q� Q�R��	$=��V�}�rZc�"�|j�|j�sy|�td��|jD]�}||jk(s�|j
st
d|�d���t|jj|�}|j|j�|j||||j|j|j��}t!t#|d|j$�|d��cSt'd|�d���)	zj
        return a single column from the table, generally only indexables
        are interesting
        Fz4read_column does not currently accept a where clausezcolumn [z=] can not be extracted individually; it is not data indexabler�rg)rdr�z] not found in the table)r%r.r�rbrdrr�r�rvrirtr�r@r�r_r�r1r;r	r�)r�r9rnr�r�r�ra�
col_valuess        rXr:zTable.read_column�s��	
������� �����R�S�S����A�������*�*�$�"�6�(�+3�3����D�J�J�O�O�V�4���
�
�4�9�9�%��Y�Y��e�D�M� �L�L�!�]�]��;�;�	'��
��g�j��m�Q�T�T�:��e�T�T�#�&��&��)A�B�C�CrZ)NrNNNNNN)r�r�r�rGr_r�r�rbr�zlist[IndexCol] | NonerKz list[tuple[AxisInt, Any]] | Noner�zlist[DataCol] | Noner�zlist | Noner�zdict | Noner�r�r�)rarbr�r�)r�r�r�z tuple[DataFrame, list[Hashable]]r�)r�zitertools.chain[IndexCol])r�ztuple[int, ...])r��dict[str, Any])r�r�)r�rbr�rb)r�rbrwr�r�r�r�r\r�)r�r�r�r�r�)r�r�r�r�r�z9list[tuple[np.ndarray, np.ndarray] | tuple[Index, Index]]�rPr)TNNN)r�r+r�r)r�r+rr)rrr�r+)r�r�r�rrcr�r�rTr.)r9rbr�r�r�r�)4r�r�r�r�r�r�r�rkrIr�r�r�r�r�r�r�r�r�r�rrvr7rIrbr�r�r�r�r�r�r�r\r{rrr%r�rr�r�rr�rrr,�staticmethodrrIrMr5r:r�r�s@rXrr
sI����.�K��K����O�#$�F� �$��H��N� $��,0�;?�,0�$(� ��������	�
��*�
�9��*��"����
��*�-��-�
�$��B�-��-�!�%�!�	)�!�"�F��F��%��%��2��2������ �� ��&��&��B��B��<��<������
��
�"�<�
3�*�

�$�$�
Q�	��*�I��I�X?C�T�1;�T�	
�T�nCG� �&� �5?� �	B� �D����$=�T����n��n��	n�`�A!��A!��A!��A!�F5�n����	�
!��
�
�@HL��!+��:D��:� ��)D��)D��	)D�
�)DrZrc�4�eZdZdZdZ				d			dd�Zdd�Zy)	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�Nc��td��)z[
        read the indices and the indexing array, calculate offset rows and return
        z!WORMTable needs to implement readr(r)s     rXr&zWORMTable.read�s��"�"E�F�FrZc��td��)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 writer(r+s   rXr�zWORMTable.write
s��"�"F�G�GrZr-r.r�)r�r�r�r�r�r&r�r�rZrXr�r��s>����J��� ��
G��	
G�
�
G�HrZr�c�x�eZdZdZdZ												d									d	d�Zd
dd�Z										dd�Zd
dd�Zy)r��(support the new appendable table formats�
appendableNc�8�|s2|jr&|jj|jd�|j	||||||��}|j
D]}|j
��|jsQ|j||||	��}|j�|
|d<|jj|jfi|��|j|j_
|j
D]}|j||��|j||
��y)Nrv)rbr�r�r�r�r�)r�r�r�rcrT)r�)r�r�r�r�r,rbrVrMr�create_tabler�rEr_�
write_data)r�r�rbr�r�r�r�r�r�rcr�r�r�rTrvr��optionss                 rXr�zAppendableTable.writes�� �$�.�.��L�L�$�$�T�Z�Z��9��!�!����%��%�
"�
�����A�
���������.�.��#�%�)�	/��G�
�O�O��%0�G�M�"�
'�E�M�M�&�&�u�{�{�>�g�>�!�:�:��������A�
���u�f�-��	����6��2rZc�<�|jj}|j}g}|rs|jD]d}t	|j
�j
d��}t|tj�s�C|j|jdd����ft|�r%|d}|ddD]}||z}�	|j�}nd}|jD�cgc]}|j��}	}t|	�}
|
dk(sJ|
��|jD�cgc]}|j!���}}|D�cgc]Q}|j#tj$tj&|j(�|j(dz
����S}}g}
t+|�D]H\}}|f|j||
|zj,z}|
j|j/|���J|�d}tj0t3||�|j�	�}||zdz}t5|�D]^}||z}t3|dz|z|�}||k\ry|j7||	D�cgc]}|||��	c}|�|||nd|
D�cgc]}|||��	c}�
��`ycc}wcc}wcc}wcc}wcc}w)z`
        we form the data into a 2-d including indexes,values,mask write chunk-by-chunk
        rrk�u1Fr�rgNr�r�)�indexesr�rw)r7rlr�r�r4r�rfrSrTr6r�r�rmr�r�rOrC�	transpose�roll�arangerprjr��reshaper�r�ro�write_data_chunk)r�r�r�rlr,�masksr�r�r�rc�nindexesrwr~�bvaluesrm�	new_shape�rows�chunks�start_i�end_is                    rXr_zAppendableTable.write_dataTs}���
�
� � ���#�#������%�%���A�F�F�|�'�'�Q�'�/���d�B�J�J�/��L�L����T���!>�?�&��u�:���8�D��1�2�Y���a�x����:�:�<�D��D�'+�o�o�6�o��1�9�9�o��6��w�<���1�}�&�h�&�}�*.�)9�)9�:�)9�A�!�+�+�-�)9��:�OU�V�v�!�!�+�+�b�g�g�b�i�i����&7����!��D�E�v��V����f�%�D�A�q���4�:�:�e�H�q�L�.A�#B�#H�#H�H�I��N�N�1�9�9�Y�/�0�&�
���I��x�x��I�u�-�T�Z�Z�@���)�#�a�'���v��A��)�m�G���Q��)�+�U�3�E��%����!�!��3:�;�7�a��7�5�)�7�;�,0�,<�T�'�%�(�$�29�:�'�Q��'�%�(�'�:�	
"�
�
��'7��;��V��(<��:s�J�J
�1AJ�J�.Jc��|D]#}tj|j�r�#y|djd}|t|�k7r!tj||j
��}|j
j}t|�}t|�D]
\}	}
|
|||	<�t|�D]\}	}||||	|z<�|�;|j�jtd��}|j�s||}t|�r6|jj|�|jj�yy)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
        Nrr�Fr�)rTrur�rmr�r7rlrjr�r�rrfrvr�r)r�rmrcr�rwr~r,rlrjrmrmr�s            rXrhz AppendableTable.write_data_chunk�s�� �A��7�7�1�7�7�#�����
� � ��#���C��I���8�8�E����4�D��
�
� � ���w�<�� ��(�F�A�s� �D��q��N�)��f�%�D�A�q�()�D��q�8�|�$�%�&�������$�$�T��$�6�6�A��5�5�7��A�w���t�9��J�J���d�#��J�J����rZc���|�t|�s�|�7|�5|j}|jj|jd��|S|�|j}|j
j
||��}|j
j�|S|j�sy|j
}t||||��}|j�}t|d��j�}t|�}	|	r�|j�}
t|
|
dkDj�}t|�sdg}|d|	k7r|j!|	�|ddk7r|j#dd�|j%�}t'|�D]U}
|j)t+|
|��}|j
||jd||jddz��|
}�W|j
j�|	S)	NTrXrYFr�rgrr�)rmr,r�r�r�rv�remove_rowsrr.rrOr1�sort_values�diffrjr�r�rFrL�reversedrvro)r�rnr�r�r,rvrrw�
sorted_series�lnrur��pgrrms               rXr_zAppendableTable.delete�s����=��E�
��}����
�
�����(�(����t�(�D��L�	�<��:�:�D��
�
�.�.�U��.�F���
�
� � �"��L���� ���
�
���d�E��T�B�	��(�(�*���v�E�2�>�>�@�
�
��
��
� �%�%�'�D��$�t�a�x�.�.�.�/�F��v�;�����b�z�R���
�
�b�!��a�y�A�~��
�
�a��#�����B��f�%��$�)�)�%��2�,�7���!�!��t�z�z�!�}�-�D����B��4H�1�4L�"����&�
�J�J�����	rZ)NFNNNNNNFNNT)
r�rr�r�r�rrTrr�r�r�)r�r�r�rr�r�)
rmr�rc�list[np.ndarray]r�znpt.NDArray[np.bool_] | Nonerwrzr�r�r�r.)	r�r�r�r�r�r�r_rhr_r�rZrXr�r�s���2��J������� $����� �93��	93��93��93��93�
�93�v9�v*��*�"�*�+�	*�
!�*�
�
*�X8rZr�c�h�eZdZUdZdZdZdZeZde	d<e
dd��Zedd��Z
				d
			dd
�Zy	)r�r[r�r�r�r�r�c�:�|jdjdk(S)Nrrg)r�r@r�s rXr�z"AppendableFrameTable.is_transposed�s�����q�!�&�&�!�+�+rZc�"�|r|j}|S)zthese are written transposed)rSr
s   rXrzAppendableFrameTable.get_objects����%�%�C��
rZNc	��|j|�|j�sy|j|||��}t|j�r,|j
j
|jddi�ni}t|j�D��cgc]\}}||jdus�|��}	}}t|	�dk(sJ�|	d}
||
d}g}t|j�D�]\}}
|
|jvr�||\}}|j
d�dk7rt|�}ntj|�}|j
d�}|�|j|d��|jr|}|}t|t!|d	d��
�}n&|j"}t|t!|d	d��
�}|}|j$dk(r:t'|t(j*�r |j-d|j.df�}t'|t(j*�rt1|j"||d��}n8t'|t�rt1|||�
�}nt1j2|g||�
�}t5�r|j6j8dk(sD|j:|j6k(j=�sJ|j:|j6f��t5�rt?|d��r|jAd�}|jC|���t|�dk(r|d}n
tE|d��}tG||||��}|jI|||��}|Scc}}w)Nr3rrgr�r.rlT��inplacerdrcFr�r�r�r}r�rk)rr�)%r%r.rrmrKr�r�rjrbr�r�r-r.�from_tuples�	set_namesr�r�rSrprSrTr6rgr�r+�_from_arraysrr7r��dtypesrfrr�r�r3rrI)r�rnr�r�r�rCr�rmr��inds�indr��framesr��
index_valsrOrirlrw�index_�cols_r�rs                       rXr&zAppendableFrameTable.read	s���	
���e�$���� �����u�E���E���4�&�&�'�
�I�I�M�M�$�-�-�a�0��3�R�8��	
� )����3�P�3�e�a��r�T�_�_�Q�=O�7O��3��P��4�y�A�~��~��1�g���s��A������d�i�i�(�D�A�q���(�(�(��"(��)��J���x�x���<�/��Z�(��!�-�-�j�9���H�H�W�%�E�� ����u�d��3��!�!� �����e�'�%���*F�G�� �����u�7�5�&�$�+G�H�����{�{�a��J�v�r�z�z�$B�����F�L�L��O�(<�=���&�"�*�*�-��v�x�x��f�5�Q���F�E�*��v�u�F�C���+�+�V�H�e�6�R��.�0�V�\�\�5F�5F�#�5M��	�	�V�\�\�1�6�6�8�S�2�9�9�f�l�l�:S�S�8�)�+����1��Y�Y�6�7���M�M�"��W)�Z�v�;�!�����B���Q�'�B��d�%�u�4�H�	�
�
�
�r�Y��
�
H���	��yQs�M
�,M
r�rUr-r.)r�r�r�r�r�r�rpr+r�r�r�r�r�rr&r�rZrXr�r��so��2��K�#�J��D�)2�H�&�2�
�,��,������� ��R��	R�
�RrZr�c�z��eZdZdZdZdZdZeZe	d	d��Z
ed
d��Zdd�fd�
Z
				d
					d�fd�
Z�xZS)r�r[r�r�r�c��yr�r�r�s rXr�z#AppendableSeriesTable.is_transposedfr�rZc��|Sr\r�r
s   rXrz AppendableSeriesTable.get_objectjs���
rZc���t|t�s!|jxsd}|j|�}t	�|�d||jj�d�|��y)�+we are going to write this as a frame tablerw�r�r�Nr�)rSr+rd�to_framer�r�r�r1)r�r�r�r�rdr�s     �rXr�zAppendableSeriesTable.writeosL����#�y�)��8�8�'�x�D��,�,�t�$�C�
��
�K�#�C�K�K�,>�,>�,@�K�F�KrZc�f��|j}|�F|rDt|jt�sJ�|jD]}||vs�|j	d|��t
�|�||||��}|r|j|jd��|jdd�df}|jdk(rd|_	|S)Nrr?Trrw)
r�rSrkrjrFr�r&�	set_indexrPrd)	r�rnr�r�r�r�r	rWr�s	        �rXr&zAppendableSeriesTable.readvs�����,�,����>��d�k�k�4�0�0�0��[�[���G�#��N�N�1�a�(�!�
�G�L�u�g�U��L�N���
�K�K����T�K�2�
�F�F�1�a�4�L��
�6�6�X���A�F��rZr�rUr\r�r-r�)r�r�r�r�r�r�rpr1r�r�r�r�rr�r&r�r�s@rXr�r�^s|���2� �K�$�J��D��H�
��������L��� ����	�
��
�
�rZr�c�,��eZdZdZdZdZd�fd�Z�xZS)r�r[r�r�c���|jxsd}|j|�\}|_t|jt�sJ�t	|j�}|j|�t
|�|_t�|�$dd|i|��y)r�rwr�Nr�)
rdr�rkrSrjr�r-r�r�r�)r�r�r�rd�newobjrir�s      �rXr�z AppendableMultiSeriesTable.write�su����x�x�#�8��"�6�6�s�;������$�+�+�t�,�,�,��D�K�K� �����D���t����
��
�+�&�+�F�+rZr�)r�r�r�r�r�r�r�r�r�s@rXr�r��s���2� �K�)�J�,�,rZr�c�n�eZdZUdZdZdZdZeZde	d<e
d
d��Ze
d��Zdd	�Z
ed
��Zdd�Zy)r�z:a table that read/writes the generic pytables table formatr�r�r�zlist[Hashable]rkc��|jSr\)r�r�s rXr�zGenericTable.pandas_type�s�����rZc�L�t|jdd�xs|jSr�r�r�s rXrzGenericTable.storable�s���t�z�z�7�D�1�?�T�Z�Z�?rZc�N�g|_d|_g|_|jD�cgc]}|js�|��c}|_|jD�cgc]}|jr�|��c}|_|jD�cgc]}|j��c}|_ycc}wcc}wcc}w)rMN)	rKr�rkr�rr�r�rdr�r�s  rXrzGenericTable.get_attrs�s��� ���������&*�o�o�K�o���9J�9J�1�o�K���'+���P��!�a�>O�>O�A��P���-1�-=�-=�>�-=��Q�V�V�-=�>����L��P��>s�B�B�B�"B�<B"c
��|j}|jd�}|�dnd}tdd|j||��}|g}t	|j
�D]h\}}t
|t�sJ�t||�}|j|�}|�dnd}t|||g||j||��}	|j|	��j|S)z0create the indexables from the table descriptionr�Nrwr)rdr@rvr�r)rdrrwrrvr�r)rIr{r�rvrj�_v_namesrSrbr�r�r�)
r�r{r�r�r�r�rmr	r�r�s
          rXr�zGenericTable.indexables�s���
����
�
�
��
(���^�z���#��q��
�
���
�	�IR�{���a�j�j�)�D�A�q��a��%�%�%��1�a�=�D��#�#�A�&�B�!#��:�T�D�(����s���j�j����B�
���r�"�*�"�rZc��td��)Nz cannot write on an generic tabler()r�r�s  rXr�zGenericTable.write�s��!�"D�E�ErZNr�r�)r�r�r�r�r�r�rpr+r�r�r�r�rrrr�r�r�rZrXr�r��sg��D��K� �J��D��H���
� �� ��@��@�?�� �� �FFrZr�c���eZdZdZdZeZdZejd�Z
edd��Zd	d
�fd�
Z
				d			d�fd�
Z�xZS)
r�za frame with a multi-indexr�r�z^level_\d+$c��y)N�appendable_multir�r�s rXr�z*AppendableMultiFrameTable.table_type_short�s��!rZc�*��|�g}n|dur|jj�}|j|�\}|_t	|jt
�sJ�|jD]}||vs�|j
d|��t�|� d||d�|��y)NTrr�r�)	r�r1r�rkrSrjrFr�r�)r�r�r�r�r	r�s     �rXr�zAppendableMultiFrameTable.write�s�������L�
�T�
!��;�;�-�-�/�L��3�3�C�8���T�[��$�+�+�t�,�,�,����A���$��#�#�A�q�)��	��
�C�#�L�C�F�CrZc�,��t�|�||||��}|j|j�}|jj|jjD�cgc]!}|jj|�rdn|��#c}�|_|Scc}w)Nr?)	r�r&r�rkr�r�rl�
_re_levels�search)r�rnr�r�r�r�rdr�s       �rXr&zAppendableMultiFrameTable.read�s�����W�\��w�e�$�\�
O��
�\�\�$�+�+�
&���8�8�%�%�HJ�����W���T�_�_�+�+�D�1�T�t�
;��W�
����	��
Xs�&Br�r\r�r-r.)r�r�r�r�r�r+r�rp�re�compiler�r�r�r�r&r�r�s@rXr�r��si���$�(�J��H��D�����N�+�J�
�"��"�
D��� ����	�
��rZr�c��|j|�}t|�}|�t|�}|�|j|�r|j|�r|St|j��}|�*t|j��j	|d��}|j|�s7tdd�g|jz}|||<|jt|�}|S)NF)�sort)	r=r;�equals�uniquerx�slicerpryrk)r�r@rHr&r��slicers      rXrrs���

���t�	�B�
�&�
!�F�
���U�#��
�
����u�-�6�=�=��3D��
�
�&�-�-�/�
*�F����e�l�l�n�-�:�:�6��:�N���=�=���',�T�4�'8�&9�C�H�H�&D����t���g�g�e�F�m�$���JrZc�0�tj|�}|S)z+for a tz-aware type, return an encoded zone)r�get_timezone)r	�zones  rXrcrc)s���!�!�"�%�D��KrZc��yr\r��rwr	r�s   rXr;r;/s��rZc��yr\r�r�s   rXr;r;6s��rZc��t|t�r+|j�|j|k(sJ�|j�|S|�it|t�r
|j}nd}|j	�}t|�}t||��}|j
d�j|�}|S|rtj|d��}|S)a
    coerce the values to a DatetimeIndex if tz is set
    preserve the input shape if possible

    Parameters
    ----------
    values : ndarray or Index
    tz : str or tzinfo
    coerce : if we do not have a passed timezone, coerce to M8[ns] ndarray
    Nrcr>�M8[ns]r�)
rSr,r	rdr�rYr@rArTr�)rwr	r�rds    rXr;r;;s����&�-�(��y�y� �F�I�I��O�3�3��9�9� ��M�	�~��f�m�,��;�;�D��D��\�\�^�F�
�R�
 ���v�D�1���#�#�E�*�5�5�b�9���M�
����F�(�3���MrZc�z�t|t�sJ�|j}t|�\}}t	|�}t
j
|�}tj|jd�s*t|j�st|j�r(t||||t|dd�t|dd�|��St|t�rtd��tj |d��}	t#j$|�}
|	dk(rgt#j$|
D�cgc]}|j'���c}t"j(�	�}t||dt+�j-�|�
�S|	dk(rJt/|
||�}|jj0}t||dt+�j3|�|�
�S|	dvrt|||||�
�St|t"j4�r|jt6k(sJ�|dk(sJ|��t+�j9�}t|||||�
�Scc}w)N�iurr	)rwr�rrr	r
zMultiIndex not supported here!Fr}rr�)r
rR)�integer�floating)rwr�rr
r�)rSrbrdr�r�r�r�rr:r7r%r!rr�r.r�r�rTr��	toordinal�int32r��	Time32Col�_convert_string_arrayrrSr6r�r�)
rdr�r_r�r
r�r�r�r�r�rwr~rs
             rXrarabs���d�C� � � ����J�5�U�;��I�z��*�%�D��%�%�i�0�D�	������T�*��u�{�{�+�����%�
���������-��u�d�D�)�!�
�	
��%��$��8�9�9��O�O�E�%�8�M��Z�Z��
�F�����J�J�v�>�v�!����
�v�>�b�h�h�O�	���)�V�W�Y�%8�%8�%:�z�
�	
�
�(�	"�)�&�(�F�C�	��?�?�+�+�������I����)�!�
�	
�
�1�	1�����4�J�
�	
��)�R�Z�Z�0�Y�_�_��5N�N�N��x��%��%���y�#�#�%����i��t�
�K�K��/ ?s�H8c	��|jd�r.|dk(r
t|�}|St|j|��}|S|dk(r
t|�}|S|dk(r?	t	j
|D�cgc]}t
j|���c}t��}|S|dvrt	j
|�}|S|dvrt|d||��}|S|dk(rt	j
|d	�}|Std
|����cc}w#t$rFt	j
|D�cgc]}t
j|���ncc}wc}t��}Y|SwxYw)Nr�r�rr�)r��floatrrRr�r�rzunrecognized index type )r�r,r�r2rTr�rr�r�r�r�r�)r�r�r_r�r�r~s      rXrvrv�sc�����|�$��<��!�$�'�E�(�L�%"�$�)�)�D�/�2�E�$�L�#
��	��t�$�� �L�
���	T��J�J�T�B�T��� 0� 0�� 3�T�B�&�Q�E��L�
�-�	-��
�
�4� ���L�
�(�	�'��$��&�
���L�	
��	��
�
�4��7�#���L��3�D�6�:�;�;�� C���	T��J�J�t�D�t�!�� 2� 2�1� 5�t��D�F�S�E��L�	T�s0�C8�+C3�
C8�3C8�8E�D1
�0E�Ec���|jtk7r|Sttj|�}|jj
}t
j|d��}	|	dk(rtd��|	dk(rtd��|	dk(s|dk(s|St|�}
|j�}|||
<t
j|d��}	|	dk7rht|jd	�D]M}||}
t
j|
d��}	|	dk7s�%t|�|kDr||nd
|��}td|�d|	�d
���t|||�j|j�}|j }t#|t$�r1t'|j)|�xs|j)d�xsd	�}t+|xsd	|�}|�|j-|�}|�||kDr|}|j/d|��d��}|S)NFr}rz+[date] is not implemented as a table columnr1z>too many timezones in this block, create separate data columnsrRr�rzNo.zCannot serialize the column [z2]
because its data contents are not [string] but [z] object dtyperwz|Sr�)r7r�r
rTr6rdrr�r�r4r�ror�rmr�rgrrSrlr�r�rLrYr�)rdrkrr�r�r_r�r�r�r�r�r�rmrL�error_column_labelr)r�ecis                  rXrr�s����}�}������2�:�:�w�'�G����#�#�J��O�O�G�E�:�M�����E�F�F��
�"��L�
�	
�
�X�%��x�)?�����=�D��<�<�>�D��D��J��O�O�D��7�M��� ��t�z�z�!�}�%�A��q�'�C��O�O�C��>�M���(�36�w�<�!�3C�W�Q�Z�3�q�c��"��3�4F�3G�H�%��n�6���&�+�4��6�B�J�J�4�:�:�V�N��&�&�H��,��%��<�+�+�D�1�T�\�5E�5E�h�5O�T�ST�U���<�$�1�h�/�H����'�'��1���?�s�X�~��H�#�*�*�R��z�?��*�G�N��rZc�p�t|�rXt|j�d��jj	||�j
j
|j�}t|j��}tdtj|��}tj|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]
    Fr�rg�Sr�)rmr1r�rb�encoder�rgr�r rL�
libwriters�max_len_string_arrayrTr�)r�r_r��ensuredrs     rXr�r�s��� �4�y��4�:�:�<�e�,�
�S����&�)�
�W�W�W�T�Z�Z�(�	
��D�J�J�L�)�G��1�j�5�5�g�>�?�H�
�:�:�d�A�h�Z�.�1�D��KrZc��|j}tj|j�t��}t|�r�t
jt|��}d|��}t|dt�r3t|d��jj||��j}n(|j|d��jtd��}|�d}t
j ||�|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��UrFr�)r�r)r�rTr�r�r�rmr�r�r rSrFr1rbrVr�r��!string_array_replace_from_nan_reprg)r�r�r_r�r�rr7s       rXr�r�'s���&
�J�J�E�
�:�:�d�j�j�l�&�1�D�
�4�y��2�2�=��3F�G���H�:����d�1�g�u�%��$�U�+�/�/�6�6�x��6�O�W�W�D��;�;�u�5�;�1�8�8��e�8�L�D������0�0��w�?��<�<���rZc��t|t�sJt|���t|�rt	|||�}||�}|Sr\)rSrbr��
_need_convert�_get_converter)rwr<r_r��convs     rXr9r9Ms?���h��$�4�d�8�n�4�$��X���h��&�9���f����MrZc�\�����dk(rd�Sd�vr�fd�S�dk(r��fd�Std�����)Nr�c�0�tj|d��S)Nr�r��rTr�)rOs rXr�z _get_converter.<locals>.<lambda>Ws�����A�X�6rZc�2��tj|���S)Nr�r�)rOr�s �rXr�z _get_converter.<locals>.<lambda>Ys������A�T�2rZrRc�"��t|d����S)Nr�)r�)rOr_r�s ��rXr�z _get_converter.<locals>.<lambda>[s���0�
�t�h�v�
rZz
invalid kind )r�)r�r_r�s```rXr�r�UsE����|��6�6�	��	�2�2�	
��	�
�	
��=���/�0�0rZc��|dvsd|vryy)N)r�rRr�TFr�r�s rXr�r�bs���'�'�<�4�+?��rZc���t|t�st|�dkrtd��|ddk(r@|ddkr8|ddk(r0t	j
d|�}|r|j
�d}d|��}|S)	z�
    Prior to 0.10.1, we named values blocks like: values_block_0 an the
    name values_0, adjust the given name if necessary.

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

    Returns
    -------
    str
    �z6Version is incorrect, expected sequence of 3 integers.rrgr�r�zvalues_block_(\d+)�values_)rSrbrmr�r�r�r�)rdr�r��grps    rXr�r�hsx���'�3��3�w�<�!�#3��Q�R�R��q�z�Q��7�1�:��+���
�a���I�I�+�T�2����(�(�*�Q�-�C��S�E�?�D��KrZc���t|�}|jd�rd}|S|jd�rd}|S|jd�rd}|S|jd�rd}|S|jd�r|}|S|jd�rd	}|S|jd
�rd
}|S|jd�rd}|S|jd�rd}|S|d
k(rd
}|Std|�d���)zA
    Find the "kind" string describing the given dtype name.
    )rRrFrRr�r�)r�r�r�r��	timedeltar�rrwr�r�zcannot interpret dtype of [r=)rYr�r�)�	dtype_strr�s  rXr�r��s6�� �	�*�I����/�0���.�K�-
�	�	�g�	&���*�K�)
�	�	�i�	(���&�K�%
�	�	�o�	.���"�K�!
�	�	�l�	+����K�
�	�	�k�	*����K�
�	�	�f�	%����K�
�	�	�j�	)����K�
�	�	�h�	'����K�
�h�	����K��6�y�k��C�D�DrZc��t|t�r|j}t|jt�rd|jj
�d�}n|jj}|jjdvr%tj|jd��}nt|t�r|j}tj|�}||fS)zJ
    Convert the passed data into a storable form and a dtype string.
    rr=�mMr1)
rSr5r�r7r'r�rdr�rTr�r�r/r�)r�r�s  rXr�r��s����$��$��z�z���$�*�*�o�.�"�4�:�:�?�?�"3�1�5�
��Z�Z�_�_�
��z�z���$���z�z�$�)�)�D�/�*��
�D�+�	&��y�y��
�:�:�d��D����rZc�@�eZdZdZ			d							dd�Zd�Zd�Zd�Zy)	rz�
    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

    Nc���||_||_||_||_d|_d|_d|_d|_t|��rKtt�5tj|d��}|dv�rtj|�}|jtj k(rS|j|j}}|�d}|�|jj"}tj$||�||_n�t'|jj(tj*�rd|j�||jkj-�s)|j�(||jk\j-�rtd��||_ddd�|j�K|j/|�|_|j�(|jj1�\|_|_yyy#1swY�axYw)NFr})r��booleanrz3where must have index locations >= start and < stop)rvrnr�r��	conditionrG�termsrEr#rr�rr�rTr�r7�bool_r,rf�
issubclassr�r�r��generate�evaluate)r�rvrnr�r��inferreds      rXr�zSelection.__init__�s�����
���
���
���	���������
��������*�%��?�?�5��?���5�5��J�J�u�-�E��{�{�b�h�h�.�&*�j�j�$�)�)�t�� �=�$%�E��<�#'�:�:�#3�#3�D�+-�9�9�U�D�+A�%�+H��(�#�E�K�K�$4�$4�b�j�j�A� �J�J�2���
�
�8J�7O�7O�7Q� �I�I�1�u��	�	�7I�6N�6N�6P�",� U�#��,1��(�%&�(���#����u�-�D�J��z�z�%�.2�j�j�.A�.A�.C�+�����&�	$�)&�%�s
�D4G(�(G1c��|�y|jj�}	t|||jj��S#t$rB}dj|j
��}td|�d|�d��}t|�|�d}~wwxYw)z'where can be a : dict,list,tuple,stringN)r�r_rz-                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
                )	rvr�r8r_�	NameErrorrr
rr�)r�rnr�r`�qkeysrs      rXr�zSelection.generate�s����=���J�J�!�!�#��	+���!�d�j�j�>Q�>Q�R�R���
	+��H�H�Q�V�V�X�&�E��.�.3�W�5C�DI�'�J���C��S�/�s�*��
	+�s�!A�	B�
=B�Bc��|j�T|jjj|jj�|j|j
��S|j�/|jjj|j�S|jjj|j|j
��S)�(
        generate the selection
        rY)	r�rv�
read_wherer�r�r�rEr5r&r�s rXr�zSelection.selects����>�>�%��:�:�#�#�.�.����%�%�'�t�z�z��	�	�/��
��
�
�
)��:�:�#�#�4�4�T�5E�5E�F�F��z�z���$�$�4�:�:�D�I�I�$�F�FrZc��|j|j}}|jj}|�d}n
|dkr||z
}|�|}n
|dkr||z
}|j�A|jjj|jj
�||d��S|j�|jStj||�S)r�rT)r�r�r�)
r�r�rvr,r��get_where_listr�rErTrf)r�r�r�r,s    rXrOzSelection.select_coordss����j�j�$�)�)�t���
�
� � ���=��E�
�Q�Y��U�N�E��<��D�
�A�X��E�M�D��>�>�%��:�:�#�#�2�2����%�%�'�u�4�d�3��
��
�
�
)��#�#�#��y�y���%�%rZr�)rvrr�r�r�r�r�r�)r�r�r�r�r�r�r�rOr�rZrXrr�sS��	�� ��+D��+D��	+D�
�+D�
�
+D�Z+�.
G�&rZr)r_r�r�rb)rir�)r�NNFNTNNNNrrQ)r��FilePath | HDFStorer�rbr�r�r�rbr�r�r�r�r�rr�r�r�rr�r�r�r�r�r�r�rbr_rbr�r�)	Nr�rNNNNFN)r�r�r�rbr�rbrnzstr | list | Noner�r�r�r�r�zlist[str] | Noner�rr�r�)r�rGr�rGr�rr\)r�r+r@rJrHr-r�r+)r	rr��str | tzinfor�)rw�np.ndarray | Indexr	r�r�rr�r,)rwr�r	r�r�rr�r�)rwr�r	zstr | tzinfo | Noner�rr�znp.ndarray | DatetimeIndex)
rdrbr�r-r_rbr�rbr�r)r�rbr_rbr�rbr�r�)rdrbrkrIr�r�)r�r�r_rbr�rbr�r�)rwr�r<rbr_rbr�rb)r�rbr_rbr�rb)r�rbr�r)rdrbr�z
Sequence[int]r�rb)r�rbr�rb)r�rI)�r��
__future__r�
contextlibrr�r1rrrFr�r��textwrapr�typingrr	r
rrr
rrj�numpyrT�pandas._configrrrr�pandas._libsrrr��pandas._libs.libr�pandas._libs.tslibsr�pandas.compat._optionalr�pandas.compat.pickle_compatr�
pandas.errorsrrrrr�pandas.util._decoratorsr�pandas.util._exceptionsr�pandas.core.dtypes.commonr r!r"r#r$r%�pandas.core.dtypes.dtypesr&r'r(r)�pandas.core.dtypes.missingr*rr+r,r-r.r/r0r1r2r3r4�pandas.core.arraysr5r6r7�pandas.core.common�core�commonr]� pandas.core.computation.pytablesr8r9�pandas.core.constructionr:�pandas.core.indexes.apir;�pandas.core.internalsr<r=�pandas.io.commonr>�pandas.io.formats.printingr?r@�collections.abcrArBrC�typesrDr�rErFrG�pandas._typingrHrIrJrKrLrMrNrOrPrr]rYr`rerlrqrrr�rsrtr�rqryrz�
config_prefix�register_option�is_bool�is_one_of_factoryr�r�r�r�r�r�r�r/rr�r�r�r�r�r0r�r�r�rr�r�r�r�r�r�r�rrcr;rarvrr�r�r9r�r�r�r�r�rr�rZrX�<module>rs����#�����	�	����������-�)�>�4���3�4�����8������
!� ��3�0��
,��
���
$���	�	�	�,�����
��	���:�*��U��!����
�����g�G�g�N������	��
�E���
�E���V���(�#��F���>�5�*����W��F������*�&�*�*�+C�D�	�$��
�$)�!��4� �����04���59���5�$�5�	�5��5��	5�
�5��
5�
�5�
�5��5�.�5�
�5�3�5�
�5��5� 
�!5�t	
���#��� $�� �X�$�X��X�
�	X�
�X��
X��X��X��X��X�v�Z�Z�z,m�m�`e>�e>�P	
�h�
�:Y9�h�Y9�x$�w�$�63�.�3�i?�i?�XbB�5�bB�J #�,� #�F`;��`;�F�"��
dD�E�dD�NH��H�<`�e�`�Fe�?�e�P.�0�.�b,�!6�,�$@F�'�@F�F(� 4�(�X9=��	��!��+0����4�
�AF����$0��:>����
��
��
��
IN�$��$�$7�$�AE�$��$�N=L�@�:F�

�F�
�F��F�R�>#�
�#�),�#�69�#��#�L�
1���2�B�2r&�r&�w^$�#�s
�A
N�N

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists