HOME


sh-3ll 1.0
DIR:/opt/cloudlinux/venv/lib64/python3.11/site-packages/pandas/io/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/pandas/io/__pycache__/pytables.cpython-311.pyc
�

���h���
�.�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+ddl,m-Z-m.Z.m/Z/m0Z0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<ddl=m>Z>m?Z?m@Z@mAZAddlBmCZCddlDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOddlPmQZQmRZRmSZSddlTmUZUddlVmWcmXZYddlZm[Z[m\Z\ddl]m^Z_m`Z`ddlambZbddlcmdZdmeZeddlfmgZgddlhmiZimjZjer4ddlkmlZlmmZmmnZnddlompZpdd lqmrZrmsZsmtZtdd!lumvZvmwZwmxZxmyZymzZzm{Z{m|Z|m}Z}dd"lcm~Z~d#Zd$Z�d%�Z�d�d*�Z�d+�Z�e[Z�d�d.�Z�d/Z�d0e�d1<d2Z�d0e�d3<d4Z�d0e�d5<d6d6d7d7d8�Z�eEdgiZ�d9Z�d0e�d:<d;Z�d0e�d<<ej�d=��5ej�d>d?e�ej��@��ej�dAde�ej�gdB����@��ddd��n#1swxYwYda�d?a�dC�Z�												d�d�d\�Z�									d�d�df�Z�d�dj�Z�Gdk�dl��Z�Gdm�dn��Z�Gdo�dp��Z�Gdq�dre���Z�Gds�dte���Z�Gdu�dve���Z�Gdw�dxe���Z�Gdy�dz��Z�Gd{�d|e���Z�Gd}�d~e���Z�Gd�d�e���Z�Gd��d�e���Z�Gd��d�e���Z�Gd��d�e���Z�Gd��d�e���Z�Gd��d�e���Z�Gd��d�e���Z�Gd��d�e���Z�Gd��d�e���Z�Gd��d�e���Z�	d�d�d��Z�d�d��Z�e	d�d�d����Z�ed�d�d����Z�	d�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�Gd��d���Z�dS)�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_string_dtype)�lib�writers)�is_string_array)�	timezones)�HAS_PYARROW)�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�StringDtype�TimedeltaIndex�concat�isna)�Categorical�
DatetimeArray�PeriodArray)�BaseStringArray)�PyTablesExpr�maybe_expression)�array�
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�d�t|tj��r|�d��}|S)z(if we have bytes, decode them to unicoderU)�
isinstance�np�bytes_�decode)�ss �I/opt/cloudlinux/venv/lib64/python3.11/site-packages/pandas/io/pytables.py�_ensure_decodedr]�s,���!�R�Y����
�H�H�W�����H��encoding�
str | None�return�strc��|�t}|S�N)�_default_encoding�r_s r\�_ensure_encodingrg�s����$���Or^c�N�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
    )rWrb��names r\�_ensure_strrk�s&���$������4�y�y���Kr^�scope_level�intc����|dz�t|ttf��r�fd�|D��}n t|��rt	|����}|�t|��r|ndS)z�
    Ensure that the where is a Term or a list of Term.

    This makes sure that we are capturing the scope of variables that are
    passed create the terms here with a frame_level=2 (we are 2 levels down)
    �c�^��g|])}|�t|��rt|�dz���n|��*S)Nro�rl)r<�Term)�.0�term�levels  �r\�
<listcomp>z _ensure_term.<locals>.<listcomp>�sM���
�
�
����2B�$�1G�1G�Q�D��5�1�9�-�-�-�-�T���r^rqN)rW�list�tupler<rr�len)�whererlrus  @r\�_ensure_termr{�s����
�!�O�E��%�$���'�'�/�
�
�
�
��
�
�
���

�%�	 �	 �/��U��.�.�.���M�S��Z�Z�M�5�5�T�9r^z�
where criteria is being ignored as this version [%s] is too old (or
not-defined), read the file in and write it out to a new file to upgrade (with
the copy_to method)
r�incompatibility_doczu
the [%s] attribute of the existing index is [%s] which conflicts with the new
[%s], resetting the attribute to None
�attribute_conflict_docz�
your performance may suffer as PyTables will pickle object types that it cannot
map directly to c-types [inferred_type->%s,key->%s] [items->%s]
�performance_doc�fixed�table)�fr�tr�z;
: boolean
    drop ALL nan rows when appending to a table
�
dropna_docz~
: format
    default format writing format, if None, then
    put will default to 'fixed' and append will default to 'table'
�
format_doczio.hdf�dropna_tableF)�	validator�default_format)rr�Nc��t�Bddl}|att��5|jjdkaddd��n#1swxYwYtS)Nr�strict)�
_table_mod�tablesr�AttributeError�file�_FILE_OPEN_POLICY�!_table_file_open_policy_is_strict)r�s r\�_tablesr��s������
�
�
��
�
�n�
%�
%�	�	���-��9�
.�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�s�?�A�A�aTr��path_or_buf�FilePath | HDFStore�key�value�DataFrame | Series�mode�	complevel�
int | None�complib�append�bool�format�index�min_itemsize�int | dict[str, int] | None�dropna�bool | None�data_columns� Literal[True] | list[str] | None�errors�Nonec
�(�����	�
���
��|r����
����	�
�f
d�}n����
����	�
�f
d�}t|��}t|t��r9t||||���5}||��ddd��dS#1swxYwYdS||��dS)z+store this object, close it if we opened itc�B�
�|���
����	������
�
S)N)r�r�r��nan_repr�r�r�r_)r���storer�r�r_r�r�r�r�r�r�r�s ����������r\�<lambda>zto_hdf.<locals>.<lambda>s8���%�,�,�����%���%���'�
�
�r^c�B�
�|���
����	������
�
S)N)r�r�r�r�r�r�r_r���putr�s ����������r\r�zto_hdf.<locals>.<lambda>+s8���%�)�)�����%��%����$�
�
�r^)r�r�r�N)rBrWrb�HDFStore)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r_r�r�s ``    ````````  r\�to_hdfr�
s_������������$�
�
�
�
�
�
�
�
�
�
�
�
�
�
���
�
�
�
�
�
�
�
�
�
�
�
�
��!��-�-�K��+�s�#�#��
��d�i��
�
�
�	�
�
�A�e�H�H�H�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	�
	
��+�����s�!A:�:A>�A>�rrz�str | list | None�start�stop�columns�list[str] | None�iterator�	chunksizec

���|dvrtd|�d����|�t|d���}t|t��r|jstd���|}d}n�t
|��}t|t��std	���	tj
�|��}
n#ttf$rd}
YnwxYw|
std
|�d����t|f||d�|
��}d
}	|�q|���}t|��dkrtd���|d}|dd�D]!}t!||��std����"|j}|�|||||||	|���S#ttt&f$rWt|t��s@t)t*��5|���ddd��n#1swxYwY�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.

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

    Examples
    --------
    >>> df = pd.DataFrame([[1, 1.0, 'a']], columns=['x', 'y', 'z'])  # doctest: +SKIP
    >>> df.to_hdf('./store.h5', 'data')  # doctest: +SKIP
    >>> reread = pd.read_hdf('./store.h5')  # doctest: +SKIP
    )r��r+r�zmode zG is not allowed while performing a read. Allowed modes are r, r+ and a.Nrorqz&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.)rzr�r�r�r�r��
auto_close)�
ValueErrorr{rWr��is_open�OSErrorrBrb�NotImplementedError�os�path�exists�	TypeError�FileNotFoundError�groupsry�_is_metadata_of�_v_pathname�select�LookupErrorrr��close)r�r�r�r�rzr�r�r�r�r��kwargsr�r�r�r��candidate_only_group�group_to_checks                 r\�read_hdfr�Bs���l�#�#�#��
.�D�
.�
.�
.�
�
�	
�

���U��2�2�2���+�x�(�(���"�	D��B�C�C�C����
�
�$�[�1�1���+�s�+�+�	�%�G���
�	��W�^�^�K�0�0�F�F���:�&�	�	�	��F�F�F�	�����	J�#�$H�K�$H�$H�$H�I�I�I���I�4��I�I�&�I�I���
�%��;��\�\�^�^�F��6�{�{�a��� �D����$*�!�9� �#)����*�
�
��&�~�7K�L�L��$�;�����
'�2�C��|�|��������!��	
�	
�		
��
�	�;�/�����+�x�0�0�	��.�)�)�
�
����
�
�
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�
���sD�B/�/C�C�0BF�AG.�G!�G.�!G%	�%G.�(G%	�)G.�grouprK�parent_groupc��|j|jkrdS|}|jdkr,|j}||kr
|jdkrdS|j}|jdk�,dS)zDCheck if a given group is a metadata group for a given parent_group.Fro�metaT)�_v_depth�	_v_parent�_v_name)r�r��current�parents    r\r�r��sm���~��.�.�.��u��G�
�
�Q�
�
��"���\�!�!�g�o��&?�&?��4��#��	�
�Q�
�
�
�5r^c�v�eZdZUdZded<ded<				dtdud�Zdvd�Zed���Zedvd���Z	dwd�Z
dxd�Zdxd�Zdyd�Z
dzd�Zd{d�Zdvd�Zd|d�Zd}d&�Zd~dd*�Zd�d,�Zd�d.�Zd�d�d/�Zd�d0�Zed�d1���Zd�d�d3�Zdwd4�Z							d�d�d8�Z			d�d�d;�Z		d�d�d=�Z								d�d�d>�Z												d�d�dL�Zd�dxdM�Z 															d�d�dP�Z!			d�d�dS�Z"			d�d�dW�Z#d�dY�Z$d�d�d]�Z%d�d_�Z&d�da�Z'							d�d�de�Z(dvdf�Z)d�dg�Z*d�di�Z+				d�d�dm�Z,															d�d�dn�Z-d�dq�Z.d�dr�Z/d�ds�Z0dS)�r�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�_moder�NFr�r�r��
fletcher32r�rar�c�n�d|vrtd���td��}|�+||jjvrtd|jj�d����|�|�|jj}t|��|_|�d}||_d|_|r|nd|_	||_
||_d|_|j
d	d|i|��dS)
Nr�z-format is not a defined argument for HDFStorer�zcomplib only supports z
 compression.r�rr��)r�r�filters�all_complibs�default_complibrB�_pathr�r��
_complevel�_complib�_fletcher32�_filters�open)�selfr�r�r�r�r�r�r�s        r\�__init__zHDFStore.__init__7s����v����L�M�M�M�+�H�5�5����7�&�.�2M�#M�#M��S���)D�S�S�S���
��?�y�4��n�4�G�#�D�)�)��
��<��D���
����'0�7�)�)�a�����
�%�����
���	�&�&�t�&�v�&�&�&�&�&r^c��|jSrd�r��r�s r\�
__fspath__zHDFStore.__fspath__Xs
���z�r^c�T�|���|j�J�|jjS)zreturn the root node)�_check_if_openr��rootr�s r\r�z
HDFStore.root[s/��	
�������|�'�'�'��|� � r^c��|jSrdr�r�s r\�filenamezHDFStore.filenameb�
���z�r^r�c�,�|�|��Srd)�get�r�r�s  r\�__getitem__zHDFStore.__getitem__fs���x�x��}�}�r^c�2�|�||��dSrdr�)r�r�r�s   r\�__setitem__zHDFStore.__setitem__is������e�����r^c�,�|�|��Srd)�remover�s  r\�__delitem__zHDFStore.__delitem__ls���{�{�3���r^rjc��	|�|��S#ttf$rYnwxYwtdt	|��j�d|�d����)z$allow attribute access to get stores�'z' object has no attribute ')r��KeyErrorrr��type�__name__)r�rjs  r\�__getattr__zHDFStore.__getattr__osm��	��8�8�D�>�>�!���/�*�	�	�	��D�	�����G��T�
�
�#�G�G��G�G�G�
�
�	
s��+�+c�b�|�|��}|�|j}|||dd�fvrdSdS)zx
        check for existence of this key
        can match the exact pathname or the pathnm w/o the leading '/'
        NroTF)�get_noder�)r�r��noderjs    r\�__contains__zHDFStore.__contains__ysE��
�}�}�S�!�!�����#�D��t�T�!�"�"�X�&�&�&��t��ur^rmc�D�t|�����Srd)ryr�r�s r\�__len__zHDFStore.__len__�s���4�;�;�=�=�!�!�!r^c�T�t|j��}t|���d|�d�S)N�
File path: �
)rDr�r)r��pstrs  r\�__repr__zHDFStore.__repr__�s.���D�J�'�'���t�*�*�3�3�4�3�3�3�3r^rQc��|Srdr�r�s r\�	__enter__zHDFStore.__enter__�s���r^�exc_type�type[BaseException] | None�	exc_value�BaseException | None�	traceback�TracebackType | Nonec�.�|���dSrd)r�)r�rrrs    r\�__exit__zHDFStore.__exit__�s��	
�
�
�����r^�pandas�include�	list[str]c���|dkrd�|���D��S|dkr/|j�J�d�|j�dd���D��Std	|�d
����)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
        rc��g|]	}|j��
Sr��r��rs�ns  r\rvz!HDFStore.keys.<locals>.<listcomp>�s��9�9�9�a�A�M�9�9�9r^�nativeNc��g|]	}|j��
Sr�rrs  r\rvz!HDFStore.keys.<locals>.<listcomp>�s'�����"#��
���r^�/�Table)�	classnamez8`include` should be either 'pandas' or 'native' but is 'r�)r�r��
walk_nodesr�)r�rs  r\�keysz
HDFStore.keys�s���<�h���9�9�4�;�;�=�=�9�9�9�9�
��
 �
 ��<�+�+�+���'+�|�'>�'>�s�g�'>�'V�'V����
��Q�w�Q�Q�Q�
�
�	
r^�
Iterator[str]c�D�t|�����Srd)�iterr&r�s r\�__iter__zHDFStore.__iter__�s���D�I�I�K�K� � � r^�Iterator[tuple[str, list]]c#�NK�|���D]
}|j|fV��dS)z'
        iterate on key->group
        N)r�r�)r��gs  r\�itemszHDFStore.items�s?���������	#�	#�A��-��"�"�"�"�"�	#�	#r^c��t��}|j|kr@|jdvr|dvrn+|dvr'|jr td|j�d|j�d����||_|jr|���|jrC|jdkr8t���|j|j|j	���|_
tr|jrd	}t|���|j
|j|jfi|��|_d
S)a9
        Open the file in the specified mode

        Parameters
        ----------
        mode : {'a', 'w', 'r', 'r+'}, default 'a'
            See HDFStore docstring or tables.open_file for info about modes
        **kwargs
            These parameters will be passed to the PyTables open_file method.
        )r��w)r�r�)r0zRe-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     r\r�z
HDFStore.open�s6�������:�����z�Z�'�'�D�K�,?�,?�������<��/�8��
�8�8���8�8�8����
�D�J��<�	��J�J�L�L�L��?�	�t���2�2�#�I�I�-�-�����4�;K�.���D�M�-�	"���	"�*�
��S�/�/�!�'�v�'��
�D�J�I�I�&�I�I����r^c�T�|j�|j���d|_dS)z0
        Close the PyTables file handle
        N)r�r�r�s r\r�zHDFStore.close�s+���<�#��L��� � � �����r^c�F�|j�dSt|jj��S)zF
        return a boolean indicating whether the file is open
        NF)r�r��isopenr�s r\r�zHDFStore.is_opens$��
�<���5��D�L�'�(�(�(r^�fsyncc��|j�u|j���|r\tt��5t	j|j�����ddd��dS#1swxYwYdSdSdS)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�r7�fileno)r�r7s  r\r9zHDFStore.flush	s��� �<�#��L��� � � ��
4��g�&�&�4�4��H�T�\�0�0�2�2�3�3�3�4�4�4�4�4�4�4�4�4�4�4�4����4�4�4�4�4�4�$�#�
4�
4s�,A0�0A4�7A4c���t��5|�|��}|�td|�d����|�|��cddd��S#1swxYwYdS)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)rrr��_read_group�r�r�r�s   r\r�zHDFStore.gets���*�^�^�	+�	+��M�M�#�&�&�E��}��C�#�C�C�C�D�D�D��#�#�E�*�*�
	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s�?A�A�"Ar�r�r�c	�>���|�|��}	|	�td|�d����t|d���}|�|	���������fd�}
t|�|
|�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
        Nr<r=rorqc�6����|||����S)N)r�r�rzr���read)�_start�_stop�_wherer�r[s   ��r\�funczHDFStore.select.<locals>.func�s����6�6��U�&�'�6�R�R�Rr^�rz�nrowsr�r�r�r�r�)rr�r{�_create_storer�
infer_axes�
TableIteratorrI�
get_result)
r�r�rzr�r�r�r�r�r�r�rG�itr[s
     `      @r\r�zHDFStore.select<s�����@�
�
�c�"�"���=��?�c�?�?�?�@�@�@��U��2�2�2������&�&��	������	S�	S�	S�	S�	S�	S���
����'�����!�
�
�
���}�}���r^r�r�c���t|d���}|�|��}t|t��st	d���|�|||���S)a�
        return the selection as an Index

        .. warning::

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

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


        Parameters
        ----------
        key : str
        where : list of Term (or convertible) objects, optional
        start : integer (defaults to None), row number to start selection
        stop  : integer (defaults to None), row number to stop selection
        rorqz&can only read_coordinates with a table�rzr�r�)r{�
get_storerrWr#r��read_coordinates)r�r�rzr�r��tbls      r\�select_as_coordinateszHDFStore.select_as_coordinates�sd��4�U��2�2�2���o�o�c�"�"���#�u�%�%�	F��D�E�E�E��#�#�%�u�4�#�H�H�Hr^�columnc��|�|��}t|t��std���|�|||���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)rUr�r�)rQrWr#r��read_column)r�r�rUr�r�rSs      r\�
select_columnzHDFStore.select_column�sP��F�o�o�c�"�"���#�u�%�%�	A��?�@�@�@����f�E���E�E�Er^c
������t|d���}t|ttf��rt	|��dkr|d}t|t
��r��||�|||||	���St|ttf��std���t	|��std���|�|d}�fd�|D�����	|��}
d}tj|
|fgt�|����D]]\}}
|�td	|
�d
����|jstd|j�d����|�|j}�C|j|krtd
����^d��D��}d�|D���������fd�}t%�|
||||||||	��
�
}|�d���S)a�
        Retrieve pandas objects from multiple tables.

        .. warning::

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

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

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

        Raises
        ------
        raises KeyError if keys or selector is not found or keys is empty
        raises TypeError if keys is not a list or tuple
        raises ValueError if the tables are not ALL THE SAME DIMENSIONS
        rorqr)r�rzr�r�r�r�r�r�zkeys must be a list/tuplez keys must have a non-zero lengthNc�:��g|]}��|����Sr�)rQ)rs�kr�s  �r\rvz/HDFStore.select_as_multiple.<locals>.<listcomp>%s%���1�1�1�q�����"�"�1�1�1r^zInvalid 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�<�g|]}t|t���|��Sr�)rWr#�rs�xs  r\rvz/HDFStore.select_as_multiple.<locals>.<listcomp>:s'��9�9�9�q�J�q�%�$8�$8�9��9�9�9r^c�4�h|]}|jdd��S�r)�non_index_axes)rsr�s  r\�	<setcomp>z.HDFStore.select_as_multiple.<locals>.<setcomp>=s%��6�6�6�1�� ��#�A�&�6�6�6r^c�t���������fd��D��}t|�d������S)Nc�B��g|]}|����������S)�rzr�r�r�rB)rsr�rDrErFr�s  ����r\rvz=HDFStore.select_as_multiple.<locals>.func.<locals>.<listcomp>Bs=����������V�W�F���O�O���r^F)�axis�verify_integrity)r5�_consolidate)rDrErF�objsrgr��tblss``` ���r\rGz)HDFStore.select_as_multiple.<locals>.func?s`�����������������D��$�T�E�B�B�B�O�O�Q�Q�Qr^rHT)�coordinates)r{rWrwrxryrbr�r�r�rQ�	itertools�chain�zipr��is_table�pathnamerI�poprLrM)r�r&rz�selectorr�r�r�r�r�r�r[rIr�r[�_tblsrGrNrgrks`   `            @@r\�select_as_multiplezHDFStore.select_as_multiple�sq������V�U��2�2�2���d�T�5�M�*�*�	�s�4�y�y�A�~�~���7�D��d�C� � �
	��;�;������!�#�%��	�	�	
��$��u�
�.�.�	9��7�8�8�8��4�y�y�	A��?�@�@�@����A�w�H�2�1�1�1�D�1�1�1���O�O�H�%�%�����O�a��]�O�S��t�_�_�E�E�	Q�	Q�D�A�q��y��5��5�5�5�6�6�6��:�
��)�q�z�)�)�)����
�}�������E�!�!� �!O�P�P�P�"�
:�9�D�9�9�9��7�6��6�6�6�:�:�<�<��		R�		R�		R�		R�		R�		R�		R���
��������!�
�
�
���}�}��}�.�.�.r^Tr�r�r�r�r�r�r�r�r�r��track_timesr�c��|�td��pd}|�|��}|�|||||||||	|
|||
|���dS)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_formatr)r�r�r�r�r�r�r�r�r_r�rvr�)r�_validate_format�_write_to_group)r�r�r�r�r�r�r�r�r�r�r�r_r�rvr�s               r\r�zHDFStore.putZs���p�>�� 7�8�8�C�G�F��&�&�v�.�.������������%��%���#��	�	
�	
�	
�	
�	
r^c���t|d���}	|�|��}np#t$r�t$r�t$rO}|�td��|�|�|��}|�|�d���Yd}~dSYd}~nd}~wwxYwtj	|||��r|j
�d���dS|jstd���|�|||���S)	a:
        Remove pandas object partially by specifying the where condition

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

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

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

        rorqNz5trying to remove a node with a non-None where clause!T��	recursivez7can only remove with where on objects written as tablesrP)
r{rQr��AssertionError�	Exceptionr�r�	_f_remove�com�all_noner�rp�delete)r�r�rzr�r�r[�errrs        r\r�zHDFStore.remove�sU��*�U��2�2�2��	�����$�$�A�A���	�	�	���	�	�	���
	�
	�
	�� � �K�����
�=�=��%�%�D��������.�.�.��t�t�t�t�t� ���������
	���� �<��u�d�+�+�		A�
�G�����-�-�-�-�-��:�
� �M�����8�8�%�u�4�8�@�@�@s�)�B�?B�B�bool | list[str]r�c���|	�td���|�td��}|�td��pd}|�|��}|�|||||||||
|||
||||���dS)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_tablerxr�)r��axesr�r�r�r�r�r�r��expectedrowsr�r�r_r�)r�rryrz)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r_r�s                  r\r�zHDFStore.append�s���R���P���
��>�� 5�6�6�F��>�� 7�8�8�C�G�F��&�&�v�.�.�������������%���%��%���!	�	
�	
�	
�	
�	
r^�d�dictc����|�td���t|t��std���||vrtd���t	tt
t�j����t
tt�����z
����}d}	g}
|���D]0\}���|	�td���|}	�|
�����1|	�i�j
|}|�t|
����}
t!|�|
����}
|�|
��||	<|�||}|rV�fd�|���D��}t	|��}|D]}|�|��}��j|�|�dd��}|���D]\\}�||kr|nd}���|���}|� �fd	�|���D��nd}|j||f||d
�|���]dS)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�Z�K�|]%}�|�d���jV��&dS)�all)�howN)r�r�)rs�colsr�s  �r\�	<genexpr>z.HDFStore.append_to_multiple.<locals>.<genexpr>�s;�����O�O�D�E�$�K�&�&�5�&�1�1�7�O�O�O�O�O�Or^r��rgc�$��i|]\}}|�v�	||��
Sr�r�)rsr�r��vs   �r\�
<dictcomp>z/HDFStore.append_to_multiple.<locals>.<dictcomp>�s$���Q�Q�Q���e��q����e���r^)r�r�)r�rWr�r��nextr)�set�range�ndim�	_AXES_MAPrr.�extendr��
differencer.�sorted�get_indexer�take�values�intersection�locrr�reindexr�)r�r�r�rsr�r�r�r�rg�
remain_key�
remain_valuesr[�ordered�ordd�idxs�valid_indexr�r��dc�val�filteredr�s  `                  @r\�append_to_multiplezHDFStore.append_to_multipleEs�����>���B���
�
�!�T�"�"�	��)���
�
�1����O���
�
�D��U�5�:�.�.�/�/�#�i��U���6L�2M�2M�M�N�N�O�O���
� �
��G�G�I�I�	(�	(�D�A�q��y��)�$�V�����
�
��$�$�Q�'�'�'�'��!��j��&�G��%�%�e�M�&:�&:�;�;�D��'�-�-�d�3�3�4�4�D�#�L�L��.�.�A�j�M����X�;�L��	+�O�O�O�O�A�H�H�J�J�O�O�O�D��t�*�*�K��
>�
>��)�6�6�u�=�=����I�k�*�E��z�z�.�$�7�7���G�G�I�I�	R�	R�D�A�q�!"�h�����D�B��-�-���-�-�-�C� �+�R�Q�Q�Q��0B�0B�0D�0D�Q�Q�Q�Q��
�

�D�K��3�Q�R�h�Q�Q�&�Q�Q�Q�Q�	R�	Rr^�optlevel�kindr`c���t��|�|��}|�dSt|t��st	d���|�|||���dS)a�
        Create a pytables index on the table.

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

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

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

        Raises
        ------
        TypeError: raises if the node is not a table
        Nz1cannot create table index on a Fixed format store)r�r�r�)r�rQrWr#r��create_index)r�r�r�r�r�r[s      r\�create_table_indexzHDFStore.create_table_index�sh��>	�	�	�	��O�O�C� � ���9��F��!�U�#�#�	Q��O�P�P�P�	���w����E�E�E�E�Er^rwc��t��|���|j�J�t�J�d�|j���D��S)a�
        Return a list of all the top-level nodes.

        Each node returned is not a pandas storage object.

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

        Examples
        --------
        >>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
        >>> store = pd.HDFStore("store.h5", 'w')  # doctest: +SKIP
        >>> store.put('data', df)  # doctest: +SKIP
        >>> print(store.groups())  # doctest: +SKIP
        >>> store.close()  # doctest: +SKIP
        [/data (Group) ''
          children := ['axis0' (Array), 'axis1' (Array), 'block0_values' (Array),
          'block0_items' (Array)]]
        Nc���g|]t}t|tjj��sSt	|jdd��s;t	|dd��s*t|tjj��r
|jdk�r|��uS)�pandas_typeNr�)	rWr��link�Link�getattr�_v_attrsr�r#r�)rsr-s  r\rvz#HDFStore.groups.<locals>.<listcomp>�s���
�
�
���q�*�/�"6�7�7�	
��A�J�
�t�<�<�

��q�'�4�0�0�
�#�1�j�&6�&<�=�=�
�CD�)�w�BV�BV�
�CW�BV�BVr^)r�r�r�r��walk_groupsr�s r\r�zHDFStore.groups�sh��,	�	�	�	��������|�'�'�'��%�%�%�
�
��\�-�-�/�/�
�
�
�	
r^r"rz�*Iterator[tuple[str, list[str], list[str]]]c#�0K�t��|���|j�J�t�J�|j�|��D]�}t|jdd����g}g}|j���D]n}t|jdd��}|�:t|tj
j��r|�|j
���T|�|j
���o|j�d��||fV���dS)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_childrenr�rWr��Groupr�r�r��rstrip)r�rzr-r��leaves�childr�s       r\�walkz
HDFStore.walk�s(����N	�	�	�	��������|�'�'�'��%�%�%���)�)�%�0�0�	>�	>�A��q�z�=�$�7�7�C���F��F���-�-�/�/�
1�
1��%�e�n�m�T�J�J���&�!�%��)9�)?�@�@�5��
�
�e�m�4�4�4���M�M�%�-�0�0�0�0��=�'�'��,�,�f�f�=�=�=�=�=�	>�	>r^�Node | Nonec�b�|���|�d��sd|z}|j�J�t�J�	|j�|j|��}n#tjj$rYdSwxYwt|tj	��sJt|�����|S)z9return the node with the key or None if it does not existr"N)r��
startswithr�r�rr��
exceptions�NoSuchNodeErrorrWrKr)r�r�rs   r\rzHDFStore.get_node1s����������~�~�c�"�"�	���)�C��|�'�'�'��%�%�%�	��<�(�(���C�8�8�D�D���$�4�	�	�	��4�4�	�����$�
��0�0�<�<�$�t�*�*�<�<�0��s� A#�#A;�:A;�GenericFixed | Tablec��|�|��}|�td|�d����|�|��}|���|S)z<return the storer object for a key, raise if not in the fileNr<r=)rr�rJrK)r�r�r�r[s    r\rQzHDFStore.get_storerAsW���
�
�c�"�"���=��?�c�?�?�?�@�@�@�����&�&��	�������r^r0�propindexes�	overwritec	�6�t|||||���}	|�!t|�����}t|ttf��s|g}|D]�}
|�|
��}|��|
|	vr|r|	�|
��|�|
��}t|t��rDd}
|rd�|j	D��}
|	�
|
||
t|dd��|j�����|	�
|
||j�����|	S)a;
        Copy the existing store to a new file, updating in place.

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

        Returns
        -------
        open file handle of the new store
        )r�r�r�r�NFc�*�g|]}|j�	|j��Sr�)�
is_indexedrj�rsr�s  r\rvz!HDFStore.copy.<locals>.<listcomp>ys!�� H� H� H�A�1�<� H��� H� H� Hr^r�)r�r�r_rf)r�rwr&rWrxrQr�r�r#r�r�r�r_r�)r�r�r�r�r&r�r�r�r��	new_storer[r[�datar�s              r\�copyz
HDFStore.copyKsO��8��t�W�	�j�
�
�
�	��<���	�	���$�$�D��$���
�.�.�	��6�D��	@�	@�A�����"�"�A��}��	�>�>� �,�!�(�(��+�+�+��{�{�1�~�~���a��'�'�@�.3�E�"�I� H� H��� H� H� H���$�$���#�%,�Q���%E�%E�!"��%������M�M�!�T�A�J�M�?�?�?���r^c��t|j��}t|���d|�d�}|j�rt	|�����}t
|��r�g}g}|D]�}	|�|��}|�M|�t|j	p|����|�t|pd�����h#t$r�t$rG}|�|��t|��}	|�d|	�d���Yd}~��d}~wwxYw|td||��z
}n|dz
}n|d	z
}|S)
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
rNzinvalid_HDFStore nodez[invalid_HDFStore node: r\��EmptyzFile is CLOSED)
rDr�rr�r�r&ryrQr�rqr~rrC)
r�r��output�lkeysr&r�r[r[�detail�dstrs
          r\�infoz
HDFStore.info�s���&�D�J�'�'����J�J�5�5�T�5�5�5���<�	'��4�9�9�;�;�'�'�E��5�z�z�
"������J�J�A�J� �O�O�A�.�.���=� �K�K��Q�Z�_�1�(E�(E�F�F�F�"�M�M�,�q�7S�<S�*T�*T�U�U�U���)�����$�J�J�J����A����+�F�3�3���
�
�&H��&H�&H�&H�I�I�I�I�I�I�I�I�����J����
�&��T�6�2�2�2����'�!����&�&�F��
s�+A$C�D+�$=D&�&D+c�B�|jst|j�d����dS)Nz file is not open!)r�rr�r�s r\r�zHDFStore._check_if_open�s2���|�	E�!�T�Z�"C�"C�"C�D�D�D�	E�	Er^r�c��	t|���}n&#t$r}td|�d���|�d}~wwxYw|S)zvalidate / deprecate formatsz#invalid HDFStore format specified [r\N)�_FORMAT_MAP�lowerr�r�)r�r�r�s   r\ryzHDFStore._validate_format�sc��	V� ������0�F�F���	V�	V�	V��K�&�K�K�K�L�L�RU�U�����	V�����
s�"�
A�A�ArU�DataFrame | Series | Noner_c	��|�+t|ttf��std���t	t|jdd����}t	t|jdd����}|��|�[t��t�J�t|dd��st|tj	j
��rd}d}n4td���t|t��rd	}nd
}|dkr|dz
}d|vr`ttd�}	||}	n8#t$r+}
td
|�dt|���d|����|
�d}
~
wwxYw|	||||���S|�k|�i|dkr/t|dd��}|�|jdkrd}nB|jdkrd}n4|dkr.t|dd��}|�|jdkrd}n
|jdkrd}t t"t$t&t(t*d�}	||}	n8#t$r+}
td|�dt|���d|����|
�d}
~
wwxYw|	||||���S)z"return a suitable class to operateNz(value must be None, Series, or DataFramer��
table_typer��frame_table�
generic_tablezKcannot create a storer if the object is not existing nor a value are passed�series�frame�_table)r�r�z=cannot properly create the storer for: [_STORER_MAP] [group->�,value->z	,format->�r_r��series_tabler�ro�appendable_series�appendable_multiseries�appendable_frame�appendable_multiframe)r�r�r�r�r��wormz<cannot properly create the storer for: [_TABLE_MAP] [group->)rWr2r,r�r]r�r�r�r�r�r#�SeriesFixed�
FrameFixedr�r�nlevels�GenericTable�AppendableSeriesTable�AppendableMultiSeriesTable�AppendableFrameTable�AppendableMultiFrameTable�	WORMTable)
r�r�r�r�r_r��pt�tt�_STORER_MAP�clsr�r��
_TABLE_MAPs
             r\rJzHDFStore._create_storer�s����Z���	�7J�%K�%K���F�G�G�G�
�W�U�^�]�D�I�I�
J�
J��
�W�U�^�\�4�H�H�
I�
I���:��}��	�	�	�!�-�-�-��5�'�4�0�0�	�J��:�+�1�5�5�	�'�B�(�B�B�#�1����
�e�V�,�,�!�!�B�B� �B��W�$�$��(�N�B��"���%0�:�F�F�K�
�!�"�o�����
�
�
��E��E�E�&*�5�k�k�E�E�<B�E�E���������
����
�3�t�U�X�f�E�E�E�E��:�� ���'�'�#�E�7�D�9�9�E��(� �=�A�-�-�!4�B�B�"�]�Q�.�.�!9�B���=�(�(�#�E�7�D�9�9�E��(� �=�A�-�-�!3�B�B�"�]�Q�.�.�!8�B�*�!6�&@� 4�%>��

�
�
�	��R�.�C�C���	�	�	��A��A�A�"&�u�+�+�A�A�8>�A�A����
�����	�����s�4���&�A�A�A�As0�D�
E
�&E�E
�1G:�:
H/�&H*�*H/c�*�t|dd��r
|dks|rdS|�||��}|�|||||���}|rF|jr|jr|dkr|jrtd���|js|���n|���|js|rtd���|�||||||	|
|||
|||��
�
t|t��r|r|�
|���dSdSdS)	N�emptyr�r�rzCan only append to Tablesz0Compression not supported on Fixed format stores)
�objr�r�r�r�r�r�r�r�r�r�r�rv)r�)r��_identify_grouprJrp�	is_existsr��set_object_info�writerWr#r�)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r_r�rvr�r[s                     r\rzzHDFStore._write_to_group$s{��.�5�'�4�(�(�	�f��.?�.?�6�.?��F��$�$�S�&�1�1������v�u�x�PV��W�W���	 ��:�
>�!�*�
>��7�1B�1B�q�{�1B� �!<�=�=�=��;�
$��!�!�#�#�#��
�������z�	Q�g�	Q��O�P�P�P�	
��������!�%��%���%�#�	�	
�	
�	
� �a����	*�E�	*�
�N�N�5�N�)�)�)�)�)�	*�	*�	*�	*r^r�rKc�|�|�|��}|���|���Srd)rJrKrC)r�r�r[s   r\r>zHDFStore._read_groupbs/������&�&��	�������v�v�x�x�r^c��|�|��}|j�J�|� |s|j�|d���d}|�|�|��}|S)z@Identify HDF5 group based on key, delete/create group if needed.NTr|)rr��remove_node�_create_nodes_and_group)r�r�r�r�s    r\r�zHDFStore._identify_groupgsm���
�
�c�"�"���|�'�'�'���V���L�$�$�U�d�$�;�;�;��E��=��0�0��5�5�E��r^c��|j�J�|�d��}d}|D]g}t|��s�|}|�d��s|dz
}||z
}|�|��}|�|j�||��}|}�h|S)z,Create nodes from key and return group name.Nr")r��splitry�endswithr�create_group)r�r��pathsr��p�new_pathr�s       r\rz HDFStore._create_nodes_and_groupys����|�'�'�'��	�	�#�������
	�
	�A��q�6�6�
���H��=�=��%�%�
 ��C�����M�H��M�M�(�+�+�E��}���1�1�$��:�:���D�D��r^)r�NNF)r�rbr�r�r�r�rar��rarb�r�rb)r�rbrar�)rjrb)r�rbrar��rarm)rarQ)rrrrrrrar�)r)rrbrar)rar')rar+)r�)r�rbrar��rar��rar��F)r7r�rar�)NNNNFNF)r�rbr�r�r�r�r�r��NNN�r�rbr�r�r�r��NN)r�rbrUrbr�r�r�r�)NNNNNFNF)r�r�r�r�r�r�)NTFNNNNNNr�TF)r�rbr�r�r�r�r�r�r�r�r�r�r�r�r�rbrvr�r�r�rar�)NNTTNNNNNNNNNNr�)r�rbr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rbrar�)NNF)r�r�r�r�rar�)r�rbr�r�r�r`rar�)rarw)r")rzrbrar�)r�rbrar�)r�rbrar�)r0TNNNFT)r�rbr�r�r�r�r�r�r�r�rar�)r�rbrarb)NNrUr�)r�r�r_rbr�rbrar�)NTFNNNNNNFNNNr�T)r�rbr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rbrvr�rar�)r�rK)r�rbr�r�rarK)r�rbrarK)1r�
__module__�__qualname__�__doc__�__annotations__r�r��propertyr�r�r�r�r�rrrr
rrr&r*r.r�r�r�r9r�r�rTrXrur�r�r�r�r�r�r�rrQr�r�r�ryrJrzr>r�rr�r^r\r�r��sq�������?�?�B�����J�J�J�
� $�� �
'�'�'�'�'�B�����!�!��X�!������X���������� � � � �
�
�
�
�
�
�
�
�"�"�"�"�4�4�4�4���������(
�(
�(
�(
�(
�T!�!�!�!�#�#�#�#�+J�+J�+J�+J�+J�Z�����)�)�)��X�)�4�4�4�4�4�,+�+�+�+�@��
��� $� �[�[�[�[�[�@� ��I�I�I�I�I�H!��&F�&F�&F�&F�&F�V����
�� $� �w/�w/�w/�w/�w/�z���� $�48��9=��� ��J
�J
�J
�J
�J
�X7A�7A�7A�7A�7A�z�
�"&��� $��48�� $��"�9=���%d
�d
�d
�d
�d
�V�
��_R�_R�_R�_R�_R�H�#��&F�&F�&F�&F�&F�P%
�%
�%
�%
�N:>�:>�:>�:>�:>�x���� ����� �
�� $� ��9�9�9�9�9�v0�0�0�0�jE�E�E�E������+/���
YB�YB�YB�YB�YB�@�"&��� $��48� $������� �'<*�<*�<*�<*�<*�|����
����$�����r^r�c�`�eZdZUdZded<ded<ded<					ddd�Zdd�Zdd�Zddd�ZdS)rLaa
    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�r[NFr�r�r�rar�c��||_||_||_||_|jjr|�d}|�d}|�|}t||��}||_||_||_d|_	|s|	�|	�d}	t|	��|_nd|_|
|_dS)Nr順)
r�r[rGrzrp�minrIr�r�rlrmr�r�)r�r�r[rGrzrIr�r�r�r�r�s           r\r�zTableIterator.__init__�s�����
������	���
��6�?�	$��}����}����|����u�d�#�#�D���
���
���	�����	"�y�,�� �"�	� ��^�^�D�N�N�!�D�N�$����r^rFc#�JK�|j}|j�td���||jkrdt	||jz|j��}|�dd|j||���}|}|�t|��s�`|V�||jk�d|���dS)Nz*Cannot iterate until get_result is called.)	r�rlr�r�rr�rGryr�)r�r�r�r�s    r\r*zTableIterator.__iter__�s������*����#��I�J�J�J���	�!�!��w���/���;�;�D��I�I�d�D�$�*:�7�4�<�*H�I�I�E��G��}�C��J�J�}���K�K�K���	�!�!�	
�
�
�����r^c�J�|jr|j���dSdSrd)r�r�r�r�s r\r�zTableIterator.close�s0���?�	��J��������	�	r^rlc���|j�Pt|jt��st	d���|j�|j���|_|S|rVt|jt��st	d���|j�|j|j|j	���}n|j}|�
|j|j	|��}|���|S)Nz0can only use an iterator or chunksize on a table)rzz$can only read_coordinates on a tablerP)r�rWr[r#r�rRrzrlr�r�rGr�)r�rlrz�resultss    r\rMzTableIterator.get_result�s����>�%��d�f�e�,�,�
T�� R�S�S�S�#�v�6�6�T�Z�6�H�H�D���K��	��d�f�e�,�,�
H�� F�G�G�G��F�+�+��j��
���,���E�E��J�E��)�)�D�J��	�5�9�9���
�
�����r^)NNFNF)r�r�r[r�r�r�r�r�r�r�rar��rarFrr)rlr�)	rrrrrr�r*r�rMr�r^r\rLrL�s����������&�����O�O�O������
�� $� �(%�(%�(%�(%�(%�T���� ����������r^rLc��eZdZUdZdZded<dZded<gd�Z													d4d5d�Ze	d6d���Z
e	d7d���Zd8d�Zd7d�Z
d9d�Zd:d�Ze	d:d���Zd;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>d0�Zd>d1�ZdAd2�Z dAd3�Z!dS)B�IndexCola
    an index column description class

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

    Tr��is_an_indexable�is_data_indexable)�freq�tz�
index_nameNrjrb�cnamer`rar�c��t|t��std���||_||_||_||_|p||_||_||_	||_
|	|_|
|_||_
||_|
|_||_|�|�|��t|jt��sJ�t|jt��sJ�dS)Nz`name` must be a str.)rWrbr�r�r��typrjr,rg�posr)r*r+r�r�r��metadata�set_pos)r�rjr�r�r.r,rgr/r)r*r+r�r�r�r0s               r\r�zIndexCol.__init__s���"�$��$�$�	6��4�5�5�5������	������	��]�d��
���	������	����$��������
���	� ��
��?��L�L������$�)�S�)�)�)�)�)��$�*�c�*�*�*�*�*�*�*r^rmc��|jjSrd)r.�itemsizer�s r\r3zIndexCol.itemsize<s���x� � r^c��|j�d�S)N�_kindrir�s r\�	kind_attrzIndexCol.kind_attrA����)�"�"�"�"r^r/c�F�||_|�|j�||j_dSdSdS)z,set the position of this column in the TableN)r/r.�_v_pos)r�r/s  r\r1zIndexCol.set_posEs/������?�t�x�3�!�D�H�O�O�O��?�3�3r^c
���ttt|j|j|j|j|jf����}d�d�tgd�|��D����S)N�,c�"�g|]\}}|�d|����
S�z->r��rsr�r�s   r\rvz%IndexCol.__repr__.<locals>.<listcomp>P�:��
�
�
��C���!�!�%�!�!�
�
�
r^)rjr,rgr/r�)
rx�maprDrjr,rgr/r��joinro�r��temps  r\r
zIndexCol.__repr__Ksy�����t�y�$�*�d�i���4�9�U�V�V�
�
���x�x�
�
�"%�&N�&N�&N�PT�"U�"U�
�
�
�
�
�	
r^�other�objectc�>���t��fd�dD����S)�compare 2 col itemsc3�`�K�|](}t�|d��t�|d��kV��)dSrd�r��rsr�rDr�s  ��r\r�z"IndexCol.__eq__.<locals>.<genexpr>X�T�����
�
��
�D�!�T�"�"�g�e�Q��&=�&=�=�
�
�
�
�
�
r^)rjr,rgr/�r��r�rDs``r\�__eq__zIndexCol.__eq__VsA�����
�
�
�
�
�5�
�
�
�
�
�	
r^c�.�|�|��Srd)rNrMs  r\�__ne__zIndexCol.__ne__]s���;�;�u�%�%�%�%r^c�x�t|jd��sdSt|jj|j��jS)z%return whether I am an indexed columnr�F)�hasattrr�r�r�r,r�r�s r\r�zIndexCol.is_indexed`s6���t�z�6�*�*�	��5��t�z���
�3�3�>�>r^r��
np.ndarrayr_r��3tuple[np.ndarray, np.ndarray] | tuple[Index, Index]c	��t|tj��sJt|�����|jj�||j���}t|j	��}t||||��}i}t|j��|d<|j�t|j��|d<t}tj|jd��st|jt ��rt"}n|jdkrd|vrd�}	||fi|��}n�#t$$rn}	|dkr]t'd��rNt)|	���d	��r,t,r%||fd
t/dtj���i|��}n�Yd}	~	n%d}	~	wt2$rd|vrd|d<||fi|��}YnwxYwt5||j��}
|
|
fS)
zV
        Convert the data from this selection to the appropriate pandas type.
        Nrjr)�M�i8c��tj||�dd������|d��S)Nr))r)rj)r0�
from_ordinalsr��_rename)r_�kwdss  r\r�z"IndexCol.convert.<locals>.<lambda>�sD���(A�������.�.�)�)�)��g��V����r^�
surrogatepass�future.infer_string�surrogates not allowed�dtype�python��storage�na_value)rWrX�ndarrayrr_�fieldsr,r�r]r��_maybe_convertr+r)r.r�is_np_dtyper(r-�UnicodeEncodeErrorrrbr	rr3�nanr��_set_tzr*)r�r�r�r_r��val_kindr��factory�new_pd_indexr��final_pd_indexs           r\�convertzIndexCol.converths8���&�"�*�-�-�;�;�t�F�|�|�;�;�-��<��*��D�J�'�,�,�.�.�F�"�4�9�-�-�����(�F�C�C����(���9�9��v���9� �,�T�Y�7�7�F�6�N�/4���?�6�<��-�-�
	���L�/�2
�2
�
	�$�G�G�
�\�T�
!�
!�f��&6�&6�
��G�	5�"�7�6�4�4�V�4�4�L�L��!�
	�
	�
	��/�)�)��4�5�5�*���H�H�%�%�&>�?�?�*� �*�
 '�w�� � �%�h���H�H�H� �� � ����
����������	5�	5�	5�����!%��v��"�7�6�4�4�V�4�4�L�L�L�	5����!��t�w�7�7���~�-�-s�	D�
F/�$A$F
�
F/�.F/c��|jS)zreturn the values�r�r�s r\�	take_datazIndexCol.take_data�s
���{�r^c��|jjSrd)r�r�r�s r\�attrszIndexCol.attrs��
���z�"�"r^c��|jjSrd�r��descriptionr�s r\rxzIndexCol.description��
���z�%�%r^c�8�t|j|jd��S)z!return my current col descriptionN)r�rxr,r�s r\�colzIndexCol.col�s���t�'���T�:�:�:r^c��|jS�zreturn my cython valuesrqr�s r\�cvalueszIndexCol.cvalues�s���{�r^rFc�*�t|j��Srd)r)r�r�s r\r*zIndexCol.__iter__�s���D�K� � � r^c��t|j��dkrpt|t��r|�|j��}|�A|jj|kr3t���	||j
���|_dSdSdSdS)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)r3r/)r]r�rWr�r�rjr.r3r��	StringColr/)r�r�s  r\�maybe_set_sizezIndexCol.maybe_set_size�s����4�9�%�%��1�1��,��-�-�
;�+�/�/��	�:�:���'�D�H�,=��,L�,L�"�9�9�.�.��$�(�.�S�S�����2�1�(�'�,L�,Lr^c��dSrdr�r�s r\�validate_nameszIndexCol.validate_names�����r^�handler�AppendableTabler�c���|j|_|���|�|��|�|��|�|��|���dSrd)r��validate_col�
validate_attr�validate_metadata�write_metadata�set_attr)r�r�r�s   r\�validate_and_setzIndexCol.validate_and_set�sj���]��
����������6�"�"�"����w�'�'�'����G�$�$�$��
�
�����r^c	���t|j��dkrG|j}|�>|�|j}|j|kr#t	d|�d|j�d|j�d����|jSdS)z:validate this column: return the compared against itemsizer�Nz#Trying to store a string with len [z] in [z)] column but
this column has a limit of [zC]!
Consider using min_itemsize to preset the sizes on these columns)r]r�r{r3r�r,)r�r3�cs   r\r�zIndexCol.validate_col�s����4�9�%�%��1�1���A��}��#�#�}�H��:��(�(�$�<�h�<�<� �J�<�<��J�<�<�<�����z�!��tr^c��|rCt|j|jd��}|�(||jkrt	d|�d|j�d����dSdSdS)Nzincompatible kind in col [� - r\)r�rtr6r�r�)r�r��
existing_kinds   r\r�zIndexCol.validate_attr�sq���	�#�D�J����E�E�M��(�]�d�i�-G�-G��O��O�O�4�9�O�O�O����	�	�(�(�-G�-Gr^c��|jD]�}t||d��}|�|ji��}|�|��}||vry|�w||krq|dvrLt
|||fz}t
j|tt�����d||<t||d����td|j�d|�d|�d|�d�	���|�|�|||<��dS)	z
        set/update the info for this indexable with the key/value
        if there is a conflict raise/warn as needed
        N)r)r+��
stacklevelzinvalid info for [z] for [z], existing_value [z] conflicts with new value [r\)�_info_fieldsr��
setdefaultrjr�r}�warnings�warnrr �setattrr�)r�r�r�r��idx�existing_value�wss       r\�update_infozIndexCol.update_info�s;��
�$�	!�	!�C��D�#�t�,�,�E��/�/�$�)�R�0�0�C� �W�W�S�\�\�N��c�z�z�e�/�N�e�4K�4K��0�0�0�/�3���2N�N�B��M��4�AQ�AS�AS�����
 $�C��H��D�#�t�,�,�,�,�%�/�T�Y�/�/�s�/�/�+9�/�/�&+�/�/�/����
�"�n�&@� ��C���1	!�	!r^c�v�|�|j��}|�|j�|��dSdS)z!set my state from the passed infoN)r�rj�__dict__�update)r�r�r�s   r\�set_infozIndexCol.set_info	s=���h�h�t�y�!�!���?��M� � ��%�%�%�%�%��?r^c�F�t|j|j|j��dS)zset the kind for this columnN)r�rtr6r�r�s r\r�zIndexCol.set_attr	s ����
�D�N�D�I�6�6�6�6�6r^c��|jdkrG|j}|�|j��}|�&|�&t	||dd���std���dSdSdSdS)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�r0�
read_metadatar,r+r�)r�r��new_metadata�cur_metadatas    r\r�zIndexCol.validate_metadata	s����9�
�"�"��=�L�"�0�0���<�<�L��(� �,�(� �,�4�T����-�
!�;����#�"�)�(�,�,�,�,r^c�X�|j�"|�|j|j��dSdS)zset the meta dataN)r0r�r,)r�r�s  r\r�zIndexCol.write_metadata/	s2���=�$��"�"�4�:�t�}�=�=�=�=�=�%�$r^)
NNNNNNNNNNNNN)rjrbr,r`rar�rr)r/rmrar��rDrErar�r)r�rSr_rbr�rbrarTr$rdr)r�r�r�r�rar�)r�r�rar�)r�r�rar�)"rrrrr'rr(r�r�rr3r6r1r
rNrPr�rorrrtrxr{r~r*r�r�r�r�r�r�r�r�r�r�r�r^r\r&r&�s����������!�O� � � � �"��"�"�"�"�/�/�/�L�
�
�� �
��
�����
��)+�)+�)+�)+�)+�V�!�!�!��X�!��#�#�#��X�#�"�"�"�"�	
�	
�	
�	
�
�
�
�
�&�&�&�&��?�?�?��X�?�>.�>.�>.�>.�@����#�#��X�#��&�&��X�&��;�;��X�;�����X��!�!�!�!�T�T�T�T�T�
�
�
�
���������&����!�!�!�!�>&�&�&�&�7�7�7�7�����">�>�>�>�>�>r^r&c�:�eZdZdZedd���Zdd�Zdd
�ZdS)�GenericIndexColz:an index which is not represented in the data of the tablerar�c��dS�NFr�r�s r\r�zGenericIndexCol.is_indexed8	����ur^r�rSr_rbr��tuple[Index, Index]c��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
        )rWrXrdrr1ry)r�r�r�r_r�r�s      r\rozGenericIndexCol.convert<	sG���&�"�*�-�-�;�;�t�F�|�|�;�;�-��3�v�;�;�'�'���e�|�r^r�c��dSrdr�r�s r\r�zGenericIndexCol.set_attrN	r�r^Nr)r�rSr_rbr�rbrar�r)rrrrrr�ror�r�r^r\r�r�5	s`������D�D�
�����X������$
�
�
�
�
�
r^r�c�j��eZdZdZdZdZddgZ												d,d-�fd�
Zed.d���Z	ed.d���Z
d.d�Zd/d�Zd0d�Z
d�Zed1d���Zed���Zed2d ���Zed3d!���Zed"���Zed#���Zed$���Zed%���Zd4d&�Zd5d*�Zd4d+�Z�xZS)6�DataCola3
    a data holding column, by definition this is not indexable

    Parameters
    ----------
    data   : the actual data
    cname  : the column name in the table to hold the data (typically
                values)
    meta   : a string description of the metadata
    metadata : the actual metadata
    Fr*r�Nrjrbr,r`r_�DtypeArg | Nonerar�c
�|��t���|||||||||	|
|���||_|
|_dS)N)rjr�r�r.r/r,r*r�r�r�r0)�superr�r_r�)r�rjr�r�r.r,r/r*r�r�r�r0r_r��	__class__s              �r\r�zDataCol.__init__c	s[��� 	����������������	�	
�	
�	
���
���	�	�	r^c��|j�d�S)N�_dtyperir�s r\�
dtype_attrzDataCol.dtype_attr�	s���)�#�#�#�#r^c��|j�d�S)N�_metarir�s r\�	meta_attrzDataCol.meta_attr�	r7r^c
���ttt|j|j|j|j|jf����}d�d�tgd�|��D����S)Nr;c�"�g|]\}}|�d|����
Sr=r�r>s   r\rvz$DataCol.__repr__.<locals>.<listcomp>�	r?r^)rjr,r_r��shape)
rxr@rDrjr,r_r�r�rArorBs  r\r
zDataCol.__repr__�	s~�����t�y�$�*�d�j�$�)�T�Z�X�
�
�
�
��
�x�x�
�
�"%�&Q�&Q�&Q�SW�"X�"X�
�
�
�
�
�	
r^rDrEr�c�>���t��fd�dD����S)rGc3�`�K�|](}t�|d��t�|d��kV��)dSrdrIrJs  ��r\r�z!DataCol.__eq__.<locals>.<genexpr>�	rKr^)rjr,r_r/rLrMs``r\rNzDataCol.__eq__�	sA�����
�
�
�
�
�6�
�
�
�
�
�	
r^r�rMc��|�J�|j�J�t|��\}}||_||_t|��|_dSrd)r_�_get_data_and_dtype_namer��_dtype_to_kindr�)r�r��
dtype_names   r\�set_datazDataCol.set_data�	sO�������z�!�!�!�3�D�9�9���j���	���
�"�:�.�.��	�	�	r^c��|jS)zreturn the data�r�r�s r\rrzDataCol.take_data�	s
���y�r^r�rIc��|j}|j}|j}|jdkr	d|jf}t|t��r)|j}|�||jj	���}n�tj|d��st|t��r|�
|��}n�tj|d��r|�|��}n{t|��r*t!���||d���}nBt%|��r|�||��}n|�||j	���}|S)zW
        Get an appropriately typed and shaped pytables.Col object for values.
        ro�r�rV�mr�r3r�)r_r3r�r��sizerWr7�codes�
get_atom_datarjrrgr(�get_atom_datetime64�get_atom_timedelta64r#r��
ComplexColr%�get_atom_string)r�r�r_r3r�r��atoms       r\�	_get_atomzDataCol._get_atom�	sI��
����>������;�!������$�E��f�k�*�*�	=��L�E��$�$�U���1A�$�B�B�D�D�
�_�U�C�
(�
(�		=�J�u�o�,N�,N�		=��*�*�5�1�1�D�D�
�_�U�C�
(�
(�	=��+�+�E�2�2�D�D�
�e�
$�
$�	=��9�9�'�'���q��'�J�J�D�D�
�U�
#�
#�	=��&�&�u�h�7�7�D�D��$�$�U���$�<�<�D��r^c�T�t���||d���S)Nrr��r�r��r�r�r3s   r\r�zDataCol.get_atom_string�	s#���y�y�"�"�H�E�!�H�"�E�E�Er^r��	type[Col]c���|�d��r|dd�}d|�d�}n1|�d��rd}n|���}|�d�}tt��|��S)z0return the PyTables column class for this column�uint�N�UIntrI�period�Int64Col)r��
capitalizer�r�)r�r��k4�col_name�kcaps     r\�get_atom_coltypezDataCol.get_atom_coltype�	s}���?�?�6�"�"�	$��a�b�b��B�%�b�~�~�~�H�H�
�_�_�X�
&�
&�	$�!�H�H��?�?�$�$�D��|�|�|�H��w�y�y�(�+�+�+r^c�N�|�|���|d���S)Nr�r�r��r��r�r�r�s   r\r�zDataCol.get_atom_data�	s*��.�s�#�#��#�.�.�U�1�X�>�>�>�>r^c�R�t���|d���S�Nrr��r�r��r�r�s  r\r�zDataCol.get_atom_datetime64�	�!���y�y�!�!��a��!�1�1�1r^c�R�t���|d���Sr�r�r�s  r\r�zDataCol.get_atom_timedelta64�	r�r^c�.�t|jdd��S)Nr�)r�r�r�s r\r�z
DataCol.shape�	s���t�y�'�4�0�0�0r^c��|jSr}r�r�s r\r~zDataCol.cvalues�	s���y�r^c��|r{t|j|jd��}|�'|t|j��krtd���t|j|jd��}|�||jkrtd���dSdSdS)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�rtr6rwr�r�r�r_)r�r��existing_fields�existing_dtypes    r\r�zDataCol.validate_attr�	s����		�%�d�j�$�.�$�G�G�O��*��$�t�{�BS�BS�/S�/S� �!W�X�X�X�$�T�Z���$�G�G�N��)�n��
�.J�.J� �V����		�		�*�)�.J�.Jr^rSr_r�c��t|tj��sJt|�����|jj�
||j}|j�J�|j�"t|��\}}t|��}n|}|j}|j
}t|tj��sJ�t|j��}|j
}	|j}
|j}|�J�t|��}|�d��rt#||d���}�n�|dkrtj|d���}�nf|dkr^	tjd	�|D��t&���}�n8#t($r)tjd
�|D��t&���}Y�nwxYw|dkr�|	}
|���}|
�t-gtj���}
not1|
��}|���rL|
|}
||dkxx|�t6�����jzcc<t=j||
|
d
���}n@	|�|d
���}n'#t@$r|�dd
���}YnwxYwt|��dkrtC||||���}|j"|fS)aR
        Convert the data from this selection to the appropriate pandas type.

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

        Returns
        -------
        index : listlike to become an Index
        data : ndarraylike to become a column
        N�
datetime64T��coerce�timedelta64�m8[ns]�r_rc�6�g|]}tj|����Sr��r�fromordinal�rsr�s  r\rvz#DataCol.convert.<locals>.<listcomp>9
s#��<�<�<�Q�T�%�a�(�(�<�<�<r^c�6�g|]}tj|����Sr��r�
fromtimestamprs  r\rvz#DataCol.convert.<locals>.<listcomp>=
s#��>�>�>�q�T�'��*�*�>�>�>r^r����F)�
categoriesr��validate�r��Or��r�r_r�)#rWrXrdrr_rer,r.r�r�r�r]r�r0r�r*r�rj�asarrayrEr��ravelr.�float64r6�any�astyperm�cumsum�_valuesr7�
from_codesr��_unconvert_string_arrayr�)r�r�r�r_r��	convertedr�r�r�r0r�r*r_r
r��masks                r\rozDataCol.convert
s�� �&�"�*�-�-�;�;�t�F�|�|�;�;�-��<��*��D�J�'�F��x�#�#�#��:��%=�V�$D�$D�!�I�z�!�*�-�-�D�D��I���J��9�D��)�R�Z�0�0�0�0�0��t�y�)�)���=���,��
�W���%�%�%��
�+�+�����L�)�)�,	>��	�2�d�;�;�;�I�I�
�m�
#�
#��
�9�H�=�=�=�I�I�
�f�_�_�
��J�<�<�)�<�<�<�F����	�	���
�
�
��J�>�>�I�>�>�>�f����	�	�	�
����
�Z�
�
�!�J��O�O�%�%�E�
�!�
#�2�R�Z�8�8�8�
�
��J�'�'���8�8�:�:�L�!+�T�E�!2�J��%�2�+�&�&�&�$�+�+�c�*:�*:�*A�*A�*C�*C�*K�K�&�&�&�#�.��*�g�����I�I�

>�%�,�,�U��,�?�?�	�	���
>�
>�
>�%�,�,�S�u�,�=�=�	�	�	�
>�����4� � �H�,�,�/��7�X�f����I��{�I�%�%s$�3%E�/F
�F
�I+�+!J�Jc���t|j|j|j��t|j|j|j��|j�J�t|j|j|j��dS)zset the data for this columnN)r�rtr6r�r�r�r_r�r�s r\r�zDataCol.set_attrf
s^����
�D�N�D�K�8�8�8���
�D�N�D�I�6�6�6��z�%�%�%���
�D�O�T�Z�8�8�8�8�8r^)NNNNNNNNNNNN)rjrbr,r`r_r�rar�rr�)r�rMrar�)r�rMrarI)r�rbrar��r�rbrarIr)r�rSr_rbr�rb)rrrrr'r(r�r�rr�r�r
rNr�rr�classmethodr�r�r�r�r�r�r�r~r�ror��
__classcell__�r�s@r\r�r�R	s@�������
�
��O����)�$�L�
�
�� �����
��!%�
��������@�$�$�$��X�$��#�#�#��X�#�
�
�
�
�
�
�
�
�/�/�/�/���������[��>�F�F��[�F��,�,�,��[�,��?�?�?��[�?��2�2��[�2��2�2��[�2��1�1��X�1�����X������b&�b&�b&�b&�H9�9�9�9�9�9�9�9r^r�c�x�eZdZdZdZdd�Zed���Zedd
���Zed���Z	ed���Z
d
S)�DataIndexableColz+represent a data column that can be indexedTrar�c�p�tt|j��j��st	d���dS)N�-cannot have non-object label DataIndexableCol)r%r.r�r_r�r�s r\r�zDataIndexableCol.validate_namess
s;���u�T�[�1�1�7�8�8�	N��L�M�M�M�	N�	Nr^c�F�t���|���S)N)r3r�r�s   r\r�z DataIndexableCol.get_atom_stringx
s���y�y�"�"�H�"�5�5�5r^r�rbrIc�>�|�|�����S)Nr�r�r�s   r\r�zDataIndexableCol.get_atom_data|
s!��.�s�#�#��#�.�.�0�0�0r^c�B�t�����Srdr�r�s  r\r�z$DataIndexableCol.get_atom_datetime64�
����y�y�!�!�#�#�#r^c�B�t�����Srdr�r�s  r\r�z%DataIndexableCol.get_atom_timedelta64�
r&r^Nrr)rrrrr(r�rr�r�r�r�r�r^r\r r n
s�������5�5���N�N�N�N�
�6�6��[�6��1�1�1��[�1��$�$��[�$��$�$��[�$�$�$r^r c��eZdZdZdS)�GenericDataIndexableColz(represent a generic pytables data columnN)rrrrr�r^r\r)r)�
s������2�2�2�2r^r)c��eZdZUdZded<dZded<ded<ded	<d
ed<dZd
ed<		d7d8d�Zed9d���Z	ed:d���Z
ed���Zd;d�Zd<d�Z
d=d�Zed ���Zed!���Zed"���Zed#���Zed>d$���Zed9d%���Zed&���Zd<d'�Zd<d(�Zed)���Zed9d*���Zed+���Zd?d-�Zd@d<d/�Zd9d0�Z				dAdBd4�Zd<d5�Z	dCdDd6�Z d.S)E�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_kindr�format_type�type[DataFrame | Series]�obj_typermr�r�r�Fr�rprUr�r�rKr_r`r�rar�c�$�t|t��sJt|�����t�J�t|tj��sJt|�����||_||_t|��|_||_	dSrd)
rWr�rr�rKr�r�rgr_r�)r�r�r�r_r�s     r\r�zFixed.__init__�
s����&�(�+�+�9�9�T�&�\�\�9�9�+��%�%�%��%���1�1�>�>�4��;�;�>�>�1������
�(��2�2��
�����r^c�h�|jddko!|jddko|jddkS)Nrro�
�)�versionr�s r\�is_old_versionzFixed.is_old_version�
s4���|�A��!�#�U���Q��2�(=�U�$�,�q�/�TU�BU�Ur^�tuple[int, int, int]c��tt|jjdd����}	t	d�|�d��D����}t
|��dkr|dz}n#t$rd}YnwxYw|S)zcompute and set our version�pandas_versionNc3�4K�|]}t|��V��dSrd�rmr^s  r\r�z Fixed.version.<locals>.<genexpr>�
s(����?�?�q�C��F�F�?�?�?�?�?�?r^�.r3ra)rrr)r]r�r�r�rxrryr�)r�r4s  r\r4z
Fixed.version�
s���"�'�$�*�*=�?O�QU�"V�"V�W�W��	 ��?�?�G�M�M�#�,>�,>�?�?�?�?�?�G��7�|�|�q� � �!�D�.�����	 �	 �	 ��G�G�G�	 �����s�AA/�/A>�=A>c�R�tt|jjdd����S)Nr�)r]r�r�r�r�s r\r�zFixed.pandas_type�
s!���w�t�z�':�M�4�P�P�Q�Q�Qr^c���|���|j}|�Ot|ttf��r%d�d�|D����}d|�d�}|jd�d|�d�S|jS)	�(return a pretty representation of myselfNr;c�,�g|]}t|����Sr��rDr^s  r\rvz"Fixed.__repr__.<locals>.<listcomp>�
s��">�">�">�q�<��?�?�">�">�">r^�[r\�12.12z	 (shape->�))rKr�rWrwrxrAr�)r�r[�jshapes   r\r
zFixed.__repr__�
s����������J���=��!�d�E�]�+�+�
"����">�">�A�">�">�">�?�?��!��M�M�M���&�;�;�;�q�;�;�;�;���r^c�~�t|j��|j_tt��|j_dS)zset my pandas type & versionN)rbr,rtr��_versionr8r�s r\rzFixed.set_object_info�
s-��!$�T�%5�!6�!6��
��$'��M�M��
�!�!�!r^c�.�tj|��}|Srdr)r��new_selfs  r\r�z
Fixed.copy�
s���9�T�?�?���r^c��|jSrd)rIr�s r\r�zFixed.shape�
r�r^c��|jjSrd�r�r�r�s r\rqzFixed.pathname�
ryr^c��|jjSrd)r�r�r�s r\r�z
Fixed._handle�
s
���{�"�"r^c��|jjSrd)r�r�r�s r\r�zFixed._filters�
s
���{�#�#r^c��|jjSrd)r�r�r�s r\r�zFixed._complevel�
s
���{�%�%r^c��|jjSrd)r�r�r�s r\r�zFixed._fletcher32�
s
���{�&�&r^c��|jjSrd)r�r�r�s r\rtzFixed.attrs�
rur^c��dS�zset our object attributesNr�r�s r\�	set_attrszFixed.set_attrs�
����r^c��dS)zget our object attributesNr�r�s r\�	get_attrszFixed.get_attrs�
rTr^c��|jS)zreturn my storable�r�r�s r\�storablezFixed.storable�
s���z�r^c��dSr�r�r�s r\rzFixed.is_exists�
r�r^c�.�t|jdd��S)NrI)r�rYr�s r\rIzFixed.nrowss���t�}�g�t�4�4�4r^�Literal[True] | Nonec��|�dSdS)z%validate against an existing storableNTr�rMs  r\rzFixed.validates���=��4��tr^Nc��dS)�+are we trying to operate on an old version?Nr�)r�rzs  r\�validate_versionzFixed.validate_version
rTr^c�D�|j}|�dS|���dS)zr
        infer the axes of my storer
        return a boolean indicating if we have a valid storer or not
        NFT)rYrV)r�r[s  r\rKzFixed.infer_axess*��

�M���9��5��������tr^r�r�r�c� �td���)Nz>cannot read on an abstract storer: subclasses should implement�r��r�rzr�r�r�s     r\rCz
Fixed.reads��"�L�
�
�	
r^c� �td���)Nz?cannot write on an abstract storer: subclasses should implementrc�r�r�r�s   r\rzFixed.write&s��!�M�
�
�	
r^c��tj|||��r#|j�|jd���dStd���)zs
        support fully deleting the node in its entirety (only) - where
        specification must be None
        Tr|Nz#cannot delete on an abstract storer)r�r�r�rr�r�)r�rzr�r�s    r\r�zFixed.delete+sK���<��u�d�+�+�	��L�$�$�T�Z�4�$�@�@�@��4��=�>�>�>r^)rUr�)
r�r�r�rKr_r`r�rbrar�r)rar6rr)rar+r)rar\rd�NNNN�r�r�r�r�r)r�r�r�r�rar�)!rrrrrr-rpr�rr5r4r�r
rr�r�rqr�r�r�r�rtrSrVrYrrIrr`rKrCrr�r�r^r\r+r+�
s�������
�
������K�����&�&�&�&�
�I�I�I������H����� '��
�
�
�
�
��V�V�V��X�V��	�	�	��X�	��R�R��X�R�	 �	 �	 �	 �2�2�2�2�
��������X���&�&��X�&��#�#��X�#��$�$��X�$��&�&�&��X�&��'�'�'��X�'��#�#��X�#�(�(�(�(�(�(�(�(�����X�������X���5�5��X�5�����:�:�:�:�:�	�	�	�	��� ��	
�	
�	
�	
�	
�
�
�
�
�HL�?�?�?�?�?�?�?r^r+c��eZdZUdZedediZd�e���D��ZgZ	de
d<d+d	�Zd
�Zd�Z
d,d
�Zed-d���Zd,d�Zd,d�Zd,d�Zd.d/d�Z	d.d0d�Zd1d�Zd2d�Z	d.d3d�Z	d.d4d"�Zd5d%�Z	d6d7d*�ZdS)8�GenericFixedza generified fixed version�datetimer�c��i|]\}}||��	Sr�r�)rsr[r�s   r\r�zGenericFixed.<dictcomp>=s��C�C�C�4�1�a�!�Q�C�C�Cr^r�
attributesrarbc�8�|j�|d��S)N�)�_index_type_mapr�)r�r�s  r\�_class_to_aliaszGenericFixed._class_to_aliasAs���#�'�'��R�0�0�0r^c�p�t|t��r|S|j�|t��Srd)rWr�_reverse_index_mapr�r.)r��aliass  r\�_alias_to_classzGenericFixed._alias_to_classDs2���e�T�"�"�	��L��&�*�*�5�%�8�8�8r^c	��|�tt|dd������}|tkrdd�}|}n|tkrdd�}|}n|}i}d|vr|d|d<|t
urt}d|vrPt|dt��r|d�	d��|d<n|d|d<|tusJ�||fS)	N�index_classrpc���tj|j|j|���}t	j|d���}|�(|�d���|��}|S)N)r_r)ri�UTC)r8�_simple_newr�r_r-�tz_localize�
tz_convert)r�r)r*�dta�results     r\r�z*GenericFixed._get_index_factory.<locals>.fSsf��#�/��M���D�����'�2�3�T�B�B�B���>�#�/�/��6�6�A�A�"�E�E�F��
r^c�x�t|��}tj||���}tj|d���S)Nrri)r*r9r{r0)r�r)r*r_�parrs     r\r�z*GenericFixed._get_index_factory.<locals>.f`s:��#�D�)�)��"�.�v�U�C�C�C��"�.�t�$�?�?�?�?r^r)r*zutf-8r)
rvr]r�r-r0r.r4rW�bytesrZ)r�rtrxr�rlr�s      r\�_get_index_factoryzGenericFixed._get_index_factoryJs���*�*��G�E�=�"�=�=�>�>�
�
���-�'�'�
�
�
�
��G�G�
�K�
'�
'�
@�
@�
@�
@�
�G�G�!�G����U�?�?�"�6�]�F�6�N��e�#�#�(���5�=�=��%��+�u�-�-�
+�$�T�{�1�1�'�:�:��t��� %�T�{��t���-�/�/�/�/����r^r�c�J�|�td���|�td���dS)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�rzs   r\�
validate_readzGenericFixed.validate_read{sJ�����T���
����Y���
��r^r�c��dS)NTr�r�s r\rzGenericFixed.is_exists�s���tr^c�J�|j|j_|j|j_dSrR)r_rtr�r�s r\rSzGenericFixed.set_attrs�s ��"�m��
�� �K��
���r^c��tt|jdd����|_t	t|jdd����|_|jD]4}t||t	t|j|d�������5dS)�retrieve our attributesr_Nr�r�)rgr�rtr_r]r�rnr�)r�rs  r\rVzGenericFixed.get_attrs�s���(����Z��)N�)N�O�O��
�%�g�d�j�(�H�&M�&M�N�N�����	L�	L�A��D�!�_�W�T�Z��D�-I�-I�J�J�K�K�K�K�	L�	Lr^c�.�|���dSrd)rSrfs   r\rzGenericFixed.write�s���������r^Nr�r�r�r�c�`�ddl}t|j|��}|j}t|dd��}t	||j��r5|d||�}t|dd��}	|	�t
||	���}n�tt|dd����}	t|dd��}
|
�tj	|
|	���}n
|||�}|	r9|	�
d��r$t|d	d��}t||d
���}n|	dkrtj|d
���}|r|j
S|S)z2read an array for the specified node (off of grouprN�
transposedF�
value_typerr�r�r*Tr�r�r)r�r�r�r�rW�VLArray�pd_arrayr]rXr�r�rjr�T)r�r�r�r�r�rrtr��retr_r�r*s            r\�
read_arrayzGenericFixed.read_array�sO���
�
�
��t�z�3�'�'���
���U�L�%�8�8�
��d�F�N�+�+�	6��q�'�%��*�%�C��E�<��6�6�E�� ��s�%�0�0�0���#�G�E�<��$F�$F�G�G�E��E�7�D�1�1�E�� ��h�u�E�2�2�2����5��:�&���
6��)�)�,�7�7�
6��U�D�$�/�/���c�2�d�3�3�3����-�'�'��j��H�5�5�5���	��5�L��Jr^r.c��tt|j|�d�����}|dkr|�|||���S|dkr/t|j|��}|�|||���}|St
d|�����)N�_variety�multi�r�r��regularzunrecognized index variety: )r]r�rt�read_multi_indexr��read_index_noder�)r�r�r�r��varietyrr�s       r\�
read_indexzGenericFixed.read_index�s���"�'�$�*��6F�6F�6F�"G�"G�H�H���g����(�(��E��(�E�E�E�
�	�
!�
!��4�:�s�+�+�D��(�(��U��(�F�F�E��L��D�7�D�D�E�E�Er^r�c��t|t��r1t|j|�d�d��|�||��dSt|j|�d�d��td||j|j��}|�||j	��t|j|��}|j|j
_|j|j
_t|tt f��r,|�t%|����|j
_t|tt t(f��r|j|j
_t|t��r'|j�"t/|j��|j
_dSdSdS)Nr�r�r�r�)rWr/r�rt�write_multi_index�_convert_indexr_r��write_arrayr�r�r�r�r�rjr-r0rrrrxr4r)r*�_get_tz)r�r�r�rrs     r\�write_indexzGenericFixed.write_index�sa���e�Z�(�(�	5��D�J�3� 0� 0� 0�'�:�:�:��"�"�3��.�.�.�.�.��D�J�3� 0� 0� 0�)�<�<�<�&�w��t�}�d�k�R�R�I����S�)�"2�3�3�3��4�:�s�+�+�D�!*��D�M��!&��D�M���%�-��!=�>�>�
N�,0�,@�,@��e���,M�,M��
�)��%�-��n�!M�N�N�
0�%*�Z��
�"��%��/�/�
5�E�H�4H�#*�5�8�#4�#4��
� � � �
5�
5�4H�4Hr^r/c�R�t|j|�d�|j��tt	|j|j|j����D]�\}\}}}t|j	t��rtd���|�d|��}t|||j
|j��}|�||j��t#|j|��}	|j|	j_||	j_t|	j|�d|��|��|�d|��}
|�|
|����dS)N�_nlevelsz=Saving a MultiIndex with an extension dtype is not supported.�_level�_name�_label)r�rtr��	enumeratero�levelsr��namesrWr_r)r�r�r_r�r�r�r�r�r�r�rj)r�r�r��i�lev�level_codesrj�	level_key�
conv_levelr�	label_keys           r\r�zGenericFixed.write_multi_index�sN����
�s�,�,�,�e�m�<�<�<�+4����e�k�5�;�7�7�,
�,
�	5�	5�'�A�'��[�$��#�)�^�4�4�
�)�S�����)�)�a�)�)�I�'�	�3��
�t�{�S�S�J����Y�
�(9�:�:�:��4�:�y�1�1�D�!+��D�M��!%�D�M��
�D�M�c�#6�#6��#6�#6��=�=�=��)�)�a�)�)�I����Y��4�4�4�4�)	5�	5r^c��t|j|�d���}g}g}g}t|��D]�}|�d|��}	t|j|	��}
|�|
||���}|�|��|�|j��|�d|��}|�|||���}
|�|
����t|||d���S)Nr�r�r�r�T)r�r�r�rh)	r�rtr�r�r�r�rjr�r/)r�r�r�r�r�r�r�r�r�r�rr�r�r�s              r\r�zGenericFixed.read_multi_indexs���$�*��&6�&6�&6�7�7������ "���w���		&�		&�A��)�)�a�)�)�I��4�:�y�1�1�D��&�&�t�5�t�&�D�D�C��M�M�#�����L�L���"�"�"��)�)�a�)�)�I��/�/�)�5�t�/�L�L�K��L�L��%�%�%�%����e�d�
�
�
�	
r^rrKc	��|||�}d|jvrLtj|jj��dkr*tj|jj|jj���}t
|jj��}d}d|jvr(t|jj	��}t
|��}|j}|�
|��\}}	|dvr,|t|||j|j
���fdti|	��}
n�	|t|||j|j
���fi|	��}
n�#t$r�}|j
dkrxt!d	��rit#|���d
��rGt&r@|t|||j|j
���fdt)dtj���i|	��}
n�Yd}~nd}~wwxYw||
_	|
S)
Nr�rrrj)rrEr�r_r\r]r^r`ra)r�rX�prodr�r�r�r]r�rkrjr��_unconvert_indexr_r�rErhrrbr	rr3ri)r�rr�r�r�r�rjrtrlr�r�r�s            r\r�zGenericFixed.read_index_nodes8���E�$�J����d�m�#�#����
�0C�(D�(D��(I�(I��8�D�M�/�t�}�7O�P�P�P�D��t�}�1�2�2�����T�]�"�"��t�}�1�2�2�D�"�4�(�(�D��
���1�1�%�8�8�����%�%�%��G� ��$���t�{�������	�
���E�E�
���$��d�T�]�4�;�������	�����&�
�
�
��K�?�2�2�"�#8�9�9�3��C���)�)�*B�C�C�3�$�3�
$�G�(� �$���t�{������*�(�R�V�L�L�L�	�
!���E�E���E�E�E�E�����
����"��
��s�<$D!�!
F9�+BF4�4F9r�rMc��tjd|jz��}|j�|j||��t
|j|��}t|j��|j	_
|j|j	_dS)zwrite a 0-len array�roN)rXr�r�r��create_arrayr�r�rbr_r�r�r�)r�r�r��arrrs     r\�write_array_emptyzGenericFixed.write_array_emptyNsm���h�t�e�j�(�)�)����!�!�$�*�c�3�7�7�7��t�z�3�'�'��#&�u�{�#3�#3��
� �#�k��
���r^r�rLr.�Index | Nonec�	�t|d���}||jvr |j�|j|��|jdk}d}t|jt��rtd���|st|d��r	|j
}d}d}|j�Wtt��5t��j�|j��}ddd��n#1swxYwY|�Q|s7|j�|j|||j|j���}||dd�<�nD|�||���n,|jjt*jkr�t/j|d���}	|rn<|	d	krn5t2|	||fz}
t5j|
t8t;���
��|j�|j|t�������}|� |���ngt/j!|jd��rg|j�"|j||�#d����tI|j��tK|j|��j&_'�n�t|jtP��ru|j�"|j||j)��tK|j|��}tU|j+��|j&_+d
|jj,�d�|j&_'�nWt/j!|jd��rT|j�"|j||�#d����dtK|j|��j&_'n�t|tZ��r�|j�|j|t�������}|� |�.����tK|j|��}tI|j��|j&_'n:|r|�||��n!|j�"|j||��|tK|j|��j&_/dS)NT)�
extract_numpyrFz]Cannot store a category dtype in a HDF5 dataset that uses format="fixed". Use format="table".r�)r���skipnar�r�rVrW�datetime64[r\r�r�)0r>r�r�rr�rWr_r'r�rRr�r�rr�r��Atom�
from_dtype�
create_carrayr�r�rrX�object_r�infer_dtyper~r�r�rr �create_vlarray�
ObjectAtomr�rgr��viewrbr�r�r�r(�asi8r�r*�unitr:�to_numpyr�)
r�r�r�r.r��empty_arrayr�r��ca�
inferred_typer��vlarrrs
             r\r�zGenericFixed.write_arrayWsa���c��6�6�6���$�*����L�$�$�T�Z��5�5�5��j�A�o���
��e�k�#3�4�4�	�%�/���
��	"��u�c�"�"�
"����!�
����=�$��*�%�%�
>�
>��y�y�~�0�0���=�=��
>�
>�
>�
>�
>�
>�
>�
>�
>�
>�
>����
>�
>�
>�
>���
�
3��\�/�/��J��T�5�;��
�0������1�1�1����&�&�s�E�2�2�2�2�
�[�
���
+�
+� �O�E�%�@�@�@�M��
U���(�*�*��$�
�s�E�'B�B���
�b�"4�AQ�AS�AS�T�T�T�T��L�/�/��
�C����AU�AU�AW�AW�X�X�E��L�L������
�_�U�[�#�
.�
.�	>��L�%�%�d�j�#�u�z�z�$�7G�7G�H�H�H�;>�u�{�;K�;K�G�D�J��$�$�-�8�8�
���_�
5�
5�	>�
�L�%�%��
�C���
�
�
��4�:�s�+�+�D� '�u�x�0�0�D�M��'H�U�[�5E�'H�'H�'H�D�M�$�$�
�_�U�[�#�
.�
.�	>��L�%�%�d�j�#�u�z�z�$�7G�7G�H�H�H�;H�G�D�J��$�$�-�8�8�
���
/�
/�	>��L�/�/��
�C����AU�AU�AW�AW�X�X�E��L�L����)�)�*�*�*��4�:�s�+�+�D�'*�5�;�'7�'7�D�M�$�$�
�	>��"�"�3��.�.�.�.��L�%�%�d�j�#�u�=�=�=�7A���
�C� � �)�4�4�4s�),C!�!C%�(C%rrrrr)r�rbr�r�r�r�rar.)r�rbr�r.rar�)r�rbr�r/rar�)r�rbr�r�r�r�rar/)rrKr�r�r�r�rar.)r�rbr�rMrar�rd)r�rbr�rLr.r�rar�)rrrrr-r0rqr.rtrnrrrrvr�r�rrrSrVrr�r�r�r�r�r�r�r�r�r^r\rkrk9s��������$�$�$�j�+�x�H�O�C�C�?�+@�+@�+B�+B�C�C�C���J�����1�1�1�1�9�9�9�/�/�/�b
�
�
�
������X��(�(�(�(�
L�L�L�L�����#�#�#�#�#�LFJ�F�F�F�F�F�5�5�5�5�.5�5�5�5�4FJ�
�
�
�
�
�0HL�5�5�5�5�5�n*�*�*�*�BF�]B�]B�]B�]B�]B�]B�]Br^rkc�^��eZdZUdZdgZded<ed���Z				ddd�Zd�fd
�Z	�xZ
S)r�r�rjrEc�h�	t|jj��fS#ttf$rYdSwxYwrd)ryr�r�r�r�r�s r\r�zSeriesFixed.shape�sD��	���
�)�*�*�,�,���>�*�	�	�	��4�4�	���s��1�1Nr�r�r�rar2c���|�||��|�d||���}|�d||���}	t|||jd���}n�#t
$r�}|jdkrktd��r\t|���	d��r:tr3t|||jdtd	tj
�
�����}n�Yd}~nd}~wwxYw|S)Nr�r�r�F)r�rjr�r\r]r^r`ra)r�rjr�r_)r�r�r�r2rjrhr�rrbr	rr3rXri)	r�rzr�r�r�r�r�rr�s	         r\rCzSeriesFixed.read�s��	
���7�E�*�*�*�����u�4��@�@�������T��B�B��	��F�%�d�i�e�L�L�L�F�F��!�	�	�	����.�.��4�5�5�/���H�H�%�%�&>�?�?�/� �/�
 ������%�h���H�H�H����������������	���� �
s�A!�!
C,�+A7C'�'C,r�c���t��j|fi|��|�d|j��|�d|��|j|j_dS)Nr�r�)r�rr�r�r�rjrt)r�r�r�r�s   �r\rzSeriesFixed.write�s^�������
�c�$�$�V�$�$�$�����#�)�,�,�,�����3�'�'�'��(��
���r^rh�r�r�r�r�rar2r)rrrr,rnrrr�rCrrrs@r\r�r��s����������K���J��N�N�N�
����X���� �������<#�#�#�#�#�#�#�#�#�#r^r�c�^��eZdZUddgZded<edd���Z				ddd�Zd�fd�Z�xZ	S)�BlockManagerFixedr��nblocksrmra�Shape | Nonec�z�	|j}d}t|j��D]9}t|jd|�d���}t|dd��}|�||dz
}�:|jj}t|dd��}|�t
|d|dz
���}ng}|�|��|S#t$rYdSwxYw)Nr�block�_itemsr�ro)	r�r�r�r�r��
block0_valuesrwr�r�)r�r�r.r�rr�s      r\r�zBlockManagerFixed.shape�s���	��9�D��E��4�<�(�(�
&�
&���t�z�+<�1�+<�+<�+<�=�=����g�t�4�4���$��U�1�X�%�E���:�+�D��D�'�4�0�0�E�� ��U�1��q��>�2�3�3������L�L������L���	�	�	��4�4�	���s�B)B,�,
B:�9B:Nr�r�r�r,c�:�|�||��|����d��}g}t|j��D]A}||kr||fnd\}}	|�d|��||	���}
|�|
���B|d}g}t|j��D]�}|�d|�d���}
|�d|�d�||	���}||�	|
��}t|j||dd	�
��}t��rXt|tj��r>t!|d���r-|�t%tj�
����}|�|����t)|��dkrMt+|dd���}t-��r|���}|�|d	���}|St|d|d���S)Nrrrgr�r�r�rroF�r�r�r�Tr�)rc)rgr�)r�r��r�r�)r�r/�_get_block_manager_axisr�r�r�r�r�r�r�r,r�rrWrXrdrrr3riryr5rr�r�)r�rzr�r�r��select_axisr�r�rDrE�axr.�dfs�	blk_itemsr��df�outs                 r\rCzBlockManagerFixed.read	
s��	
���7�E�*�*�*��m�m�o�o�=�=�a�@�@�����t�y�!�!�	�	�A�-.�+�-=�-=�U�D�M�M�<�M�F�E��������6���F�F�B��K�K��O�O�O�O��Q������t�|�$�$�	�	�A����(9��(9�(9�(9�:�:�I��_�_�%7�Q�%7�%7�%7�v�E�_�R�R�F��E�-�-�i�8�8�9�G��6�8�W�D��G�%�P�P�P�B�"�$�$�
=��v�r�z�2�2�
=�$�F�4�8�8�8�
=�
�Y�Y�{�B�F�;�;�;�<�<���J�J�r�N�N�N�N��s�8�8�a�<�<���1�4�0�0�0�C�"�$�$�
!��h�h�j�j���+�+�e�%�+�8�8�C��J���a���Q��8�8�8�8r^r�c����t��j|fi|��t|jt��r|�d��}|j}|���s|���}|j|j	_t|j��D]:\}}|dkr|jstd���|�d|��|���;t|j��|j	_t|j��D]_\}}|j�|j��}|�d|�d�|j|���|�d|�d�|���`dS)Nr�rz/Columns index has to be unique for fixed formatrgr)r.r�)r�rrW�_mgrr@�_as_manager�is_consolidated�consolidater�rtr�r��	is_uniquer�r�ry�blocksr�r.r��mgr_locsr�r�)	r�r�r�r�r�r��blkr�r�s	        �r\rzBlockManagerFixed.write6
sy�������
�c�$�$�V�$�$�$��c�h��-�-�	+��/�/�'�*�*�C��x���#�#�%�%�	&��#�#�%�%�D��)��
���t�y�)�)�	-�	-�E�A�r��A�v�v�r�|�v� �!R�S�S�S����Z�A�Z�Z��,�,�,�,�!���-�-��
�����,�,�	;�	;�F�A�s��
�����5�5�I����/�Q�/�/�/���9��M�M�M����.�Q�.�.�.�	�:�:�:�:�		;�	;r^)rar�rh)r�r�r�r�rar,r)
rrrrnrrr�rCrrrs@r\r�r��s����������)�$�J��L�L�L�
�����X��8�� ��+9�+9�+9�+9�+9�Z;�;�;�;�;�;�;�;�;�;r^r�c��eZdZdZeZdS)r�r�N)rrrr,r,r/r�r^r\r�r�P
s�������K��H�H�Hr^r�c���eZdZUdZdZdZded<ded<dZded	<d
Zded<								dedf�fd"�
Z	e
dgd#���Zdgd$�Zdhd&�Z
did'�Ze
djd)���Zdkd-�Ze
dld/���Ze
djd0���Ze
d1���Ze
d2���Ze
d3���Ze
d4���Ze
dmd6���Ze
dld7���Ze
djd8���Ze
dnd:���Zdod<�Zd=�Zdpd?�ZdqdA�ZdrdD�ZdsdE�Z didF�Z!didG�Z"dtdidH�Z#didI�Z$e%dJ���Z&	dudvdL�Z'	dwdxdQ�Z(e)dydS���Z*dT�Z+				dzd{dW�Z,e-d|dZ���Z.dtd}d]�Z/d~da�Z0	duddb�Z1			dud�dd�Z2�xZ3S)�r#aa
    represent a table:
        facilitate read/write of various types of tables

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

    index_axes    : a list of tuples of the (original indexing axis and
        index column)
    non_index_axes: a list of tuples of the (original index axis and
        columns on a non-indexing axis)
    values_axes   : a list of the columns which comprise the data of this
        table
    data_columns  : a list of the columns that we are allowing indexing
        (these become single columns in values_axes)
    nan_rep       : the string to use for nan representations for string
        objects
    levels        : the names of levels
    metadata      : the names of the metadata columns
    �
wide_tabler�rbr-r�rozint | list[Hashable]r�Trwr0Nr�r�r�r�rKr_r`r��
index_axes�list[IndexCol] | Nonerb� list[tuple[AxisInt, Any]] | None�values_axes�list[DataCol] | Noner��list | Noner��dict | Nonerar�c���t���||||���|pg|_|pg|_|pg|_|pg|_|	pi|_|
|_dS)Nr�)r�r�r�rbr�r�r�r�)r�r�r�r_r�r�rbr�r�r�r�r�s           �r\r�zTable.__init__u
so���	��������&��I�I�I�$�*����,�2����&�,�"���(�.�B����J�B��	�����r^c�B�|j�d��dS)N�_r)r�rr�s r\�table_type_shortzTable.table_type_short�
s����$�$�S�)�)�!�,�,r^c
��|���t|j��rd�|j��nd}d|�d�}d}|jr*d�d�|jD����}d|�d�}d�d�|jD����}|jd	�|�d
|j�d|j	�d|j
�d
|�d|�d�
S)r>r;rpz,dc->[r\r;c�,�g|]}t|����Sr��rbr^s  r\rvz"Table.__repr__.<locals>.<listcomp>�
s��:�:�:��S��V�V�:�:�:r^rAc��g|]	}|j��
Sr�rir�s  r\rvz"Table.__repr__.<locals>.<listcomp>�
s��@�@�@�1���@�@�@r^rBz (typ->z,nrows->z,ncols->z,indexers->[rC)rKryr�rAr5r4r�r�r�rI�ncols)r��jdcr��ver�jver�jindex_axess      r\r
zTable.__repr__�
s#��������-0��1B�-C�-C�K�c�h�h�t�(�)�)�)���
�c�_�_�_������	��8�8�:�:�T�\�:�:�:�;�;�D��d�+�+�+�C��h�h�@�@���@�@�@�A�A����-�
B�s�
B�
B��*�
B�
B�48�J�
B�
B��j�
B�
B�.9�
B�
B�<>�
B�
B�
B�	
r^r�c�8�|jD]}||jkr|cS�dS)zreturn the axis for cN)r�rj)r�r�r�s   r\r�zTable.__getitem__�
s1����	�	�A��A�F�{�{�������tr^c��|�dS|j|jkr td|j�d|j�d����dD]�}t||d��}t||d��}||kr�t|��D]p\}}||}||kr]|dkr>|j|jkr.td|jd�d	|j�d
|j�d����td|�d
|�d|�d�����qtd|�d
|�d|�d������dS)z"validate against an existing tableNz'incompatible table_type with existing [r�r\)r�rbr�r��Cannot serialize the column [rz%] because its data contents are not [z] but [�] object dtypezinvalid combination of [z] on appending data [z] vs current table [)r�r�r�r�r�r�r�r)r�rDr��sv�ovr��sax�oaxs        r\rzTable.validate�
s����=��F���t��.�.��<��$�<�<�)-��<�<�<���
�
A�	�	�A���q�$�'�'�B����4�(�(�B��R�x�x�(��m�m�
�
�F�A�s��Q�%�C��c�z�z��
�-�-�#�(�c�h�2F�2F�",�!A��
�1�
�!A�!A�FI�h�!A�!A�(+��!A�!A�!A�#�#��
)�@�q�@�@� #�@�@�9<�@�@�@����"� �,�q�,�,�r�,�,�&(�,�,�,����)�	�	r^r�c�6�t|jt��S)z@the levels attribute is 1 or a list in the case of a multi-index)rWr�rwr�s r\�is_multi_indexzTable.is_multi_index�
s���$�+�t�,�,�,r^r�r�� tuple[DataFrame, list[Hashable]]c���tj|jj��}	|���}n"#t
$r}td��|�d}~wwxYwt
|t��sJ�||fS)ze
        validate that we can store the multi-index; reset and return the
        new object
        zBduplicate names/columns in the multi-index when storing as a tableN)r��fill_missing_namesr�r��reset_indexr�rWr,)r�r�r��	reset_objr�s     r\�validate_multiindexzTable.validate_multiindex�
s����'��	��8�8��	����)�)�I�I���	�	�	��T����
�����	�����)�Y�/�/�/�/�/��&� � s�5�
A�A�Armc�H�tjd�|jD����S)z-based on our axes, compute the expected nrowsc�2�g|]}|jjd��Sra)r~r��rsr�s  r\rvz(Table.nrows_expected.<locals>.<listcomp>�
s!��D�D�D�q��	���*�D�D�Dr^)rXr�r�r�s r\�nrows_expectedzTable.nrows_expected�
s%���w�D�D�D�O�D�D�D�E�E�Er^c��d|jvS)zhas this table been createdr�rXr�s r\rzTable.is_exists�
s���$�*�$�$r^c�.�t|jdd��S�Nr��r�r�r�s r\rYzTable.storable�
s���t�z�7�D�1�1�1r^c��|jS)z,return the table group (this is my storable))rYr�s r\r�zTable.table�
s���}�r^c��|jjSrd)r�r_r�s r\r_zTable.dtype�
s
���z��r^c��|jjSrdrwr�s r\rxzTable.description�
ryr^�itertools.chain[IndexCol]c�@�tj|j|j��Srd)rmrnr�r�r�s r\r�z
Table.axes�
s����t���0@�A�A�Ar^c�>�td�|jD����S)z.the number of total columns in the values axesc3�>K�|]}t|j��V��dSrd)ryr�r�s  r\r�zTable.ncols.<locals>.<genexpr>s*����;�;�Q�3�q�x�=�=�;�;�;�;�;�;r^)�sumr�r�s r\rzTable.ncolss$���;�;�$�*:�;�;�;�;�;�;r^c��dSr�r�r�s r\�
is_transposedzTable.is_transposedr�r^�tuple[int, ...]c��ttjd�|jD��d�|jD������S)z@return a tuple of my permutated axes, non_indexable at the frontc�8�g|]}t|d����Srar:r�s  r\rvz*Table.data_orientation.<locals>.<listcomp>s"��8�8�8�q��Q�q�T���8�8�8r^c�6�g|]}t|j����Sr�)rmrgr�s  r\rvz*Table.data_orientation.<locals>.<listcomp>s ��6�6�6���Q�V���6�6�6r^)rxrmrnrbr�r�s r\�data_orientationzTable.data_orientationsL����O�8�8�D�$7�8�8�8�6�6�d�o�6�6�6�
�
�
�
�	
r^�dict[str, Any]c����ddd��d��jD��}�fd��jD��}�fd��jD��}t||z|z��S)z<return a dict of the kinds allowable columns for this objectr�r��rroc� �g|]}|j|f��Sr��r,r�s  r\rvz$Table.queryables.<locals>.<listcomp>s��
4�
4�
4�q�q�w��l�
4�
4�
4r^c�*��g|]\}}�|df��Srdr�)rsrgr��
axis_namess   �r\rvz$Table.queryables.<locals>.<listcomp>s'���
O�
O�
O�<�4��z�$���&�
O�
O�
Or^c�X��g|]&}|jt�j��v�|j|f��'Sr�)rjr�r�r,)rsr�r�s  �r\rvz$Table.queryables.<locals>.<listcomp>s=���
�
�
��a�f��D�DU�@V�@V�6V�6V�Q�W�a�L�6V�6V�6Vr^)r�rbr�r�)r��d1�d2�d3r2s`   @r\�
queryableszTable.queryabless�����!�Y�/�/�
�5�
4�D�O�
4�
4�
4��
O�
O�
O�
O�4�;N�
O�
O�
O��
�
�
�
�"&�"2�
�
�
���B��G�b�L�!�!�!r^c�$�d�|jD��S)zreturn a list of my index colsc�*�g|]}|j|jf��Sr�)rgr,rs  r\rvz$Table.index_cols.<locals>.<listcomp>'s!��;�;�;�a�����!�;�;�;r^�r�r�s r\�
index_colszTable.index_cols$s��<�;�4�?�;�;�;�;r^rc�$�d�|jD��S)zreturn a list of my values colsc��g|]	}|j��
Sr�r0rs  r\rvz%Table.values_cols.<locals>.<listcomp>+s��2�2�2�A���2�2�2r^)r�r�s r\�values_colszTable.values_cols)s��2�2��!1�2�2�2�2r^r�c�*�|jj}|�d|�d�S)z)return the metadata pathname for this keyz/meta/z/metarKr?s   r\�_get_metadata_pathzTable._get_metadata_path-s#���
�&���)�)�s�)�)�)�)r^r�rSc��|j�|�|��t|d���d|j|j|j���dS)z�
        Write out a metadata array to the key as a fixed-format Series.

        Parameters
        ----------
        key : str
        values : ndarray
        Frr�)r�r_r�r�N)r�r�r@r2r_r�r�)r�r�r�s   r\r�zTable.write_metadata2s^��	
�����#�#�C�(�(��6��&�&�&���]��;��L�
	�	
�	
�	
�	
�	
r^c��tt|jdd��|d���-|j�|�|����SdS)z'return the meta data array for this keyr�N)r�r�r�r�r@r�s  r\r�zTable.read_metadataDsK���7�4�:�v�t�4�4�c�4�@�@�L��;�%�%�d�&=�&=�c�&B�&B�C�C�C��tr^c��t|j��|j_|���|j_|���|j_|j|j_|j|j_|j|j_|j|j_|j	|j_	|j
|j_
|j|j_dS)zset our table type & indexablesN)rbr�rtr;r>rbr�r�r_r�r�r�r�s r\rSzTable.set_attrsJs��� #�D�O� 4� 4��
�� $��� 1� 1��
��!%�!1�!1�!3�!3��
��$(�$7��
�!�"&�"3��
��!�\��
��"�m��
�� �K��
�� �K��
���)��
���r^c��t|jdd��pg|_t|jdd��pg|_t|jdd��pi|_t|jdd��|_t
t|jdd����|_tt|jdd����|_	t|jd	d��pg|_
d
�|jD��|_d�|jD��|_
dS)r�rbNr�r�r�r_r�r�r�c� �g|]}|j�	|��Sr��r'r�s  r\rvz#Table.get_attrs.<locals>.<listcomp>`� ��K�K�K���9J�K�1�K�K�Kr^c� �g|]}|j�	|��Sr�rFr�s  r\rvz#Table.get_attrs.<locals>.<listcomp>a� ��P�P�P�!�a�>O�P�A�P�P�Pr^)r�rtrbr�r�r�rgr_r]r�r��
indexablesr�r�r�s r\rVzTable.get_attrsWs���%�d�j�2B�D�I�I�O�R���#�D�J���E�E�K�����D�J���5�5�;���	��t�z�9�d�;�;���(����Z��)N�)N�O�O��
�%�g�d�j�(�H�&M�&M�N�N���&-�d�j�(�D�&I�&I�&O�R���K�K�d�o�K�K�K���P�P�t��P�P�P����r^c���|�]|jrXtd�d�|jD����z}t	j|tt�����dSdSdS)r_Nr;c�,�g|]}t|����Sr�r�r^s  r\rvz*Table.validate_version.<locals>.<listcomp>gs��4R�4R�4R��S��V�V�4R�4R�4Rr^r�)r5r|rAr4r�r�rr )r�rzr�s   r\r`zTable.validate_versioncs~�����"�
�(�3�8�8�4R�4R�T�\�4R�4R�4R�+S�+S�S���
��*�/�1�1���������
�
r^c��|�dSt|t��sdS|���}|D] }|dkr�	||vrtd|�d�����!dS)z�
        validate the min_itemsize doesn't contain items that are not in the
        axes this needs data_columns to be defined
        Nr�zmin_itemsize has the key [z%] which is not an axis or data_column)rWr�r7r�)r�r��qr[s    r\�validate_min_itemsizezTable.validate_min_itemsizens���
���F��,��-�-�	��F��O�O�����	�	�A��H�}�}����z�z� �"��"�"�"�����		�	r^c�,����
���g}�j�
�jj�t�jj��D]z\}\}}t�
|��}��|��}|�dnd}|�d�}t�|d��}	t||||	|�j||���}
|�|
���{t�j
���t|������
��fd��|��fd�t�jj
��D����|S)z/create/cache the indexables if they don't existNr�r5)rjrgr/r�r.r�r�r0c���t|t��sJ�t}|�vrt}t	�
|��}t|�j��}t	�|�d�d��}t	�|�d�d��}t|��}��|��}t	�|�d�d��}	|||||�|z|�j	|	||��
�
}
|
S)Nr5r�r�)
rjr,r�r�r/r.r�r�r0r_)
rWrbr�r r��_maybe_adjust_namer4r�r�r�)r�r��klassr��adj_namer�r_r��mdr�r��base_posr��descr��table_attrss           �����r\r�zTable.indexables.<locals>.f�s����a��%�%�%�%�%��E��B�w�w�(���4��#�#�D�)�!�T�\�:�:�H��[�X�*<�*<�*<�d�C�C�F��K�H�)<�)<�)<�d�C�C�E�"�%�(�(�D��#�#�A�&�&�B��;�8�(:�(:�(:�D�A�A�D��%������q�L���j�������C��Jr^c�.��g|]\}}�||����Sr�r�)rsr�r�r�s   �r\rvz$Table.indexables.<locals>.<listcomp>�s'���R�R�R���1�A�A�a��G�G�R�R�Rr^)rxr�rtr�r;r�r�r&r�r�r�ryr�r>)r��_indexablesr�rgrjr�rUr�r6r��	index_colrVr�rWr�rXs`          @@@@@r\rJzTable.indexables�sd��������������j�&��
 )���)>�?�?�	*�	*�O�A�|��d��4��&�&�D��#�#�D�)�)�B�!#��:�:�T�D�����I��;�	�4�8�8�D� �������j���	�	�	�I�
���y�)�)�)�)���"�
#�
#���{�#�#��!	�!	�!	�!	�!	�!	�!	�!	�!	�J	���R�R�R�R�	�$�*�:P�0Q�0Q�R�R�R�S�S�S��r^r�c
��|���sdS|durdS|�|durd�|jD��}t|ttf��s|g}i}|�||d<|�||d<|j}|D]�}t
|j|d��}|��|jrY|j	}|j
}	|j}
|�|
|kr|���n|
|d<|�|	|kr|���n|	|d<|js6|j
�d��rtd���|jdi|����||jd	d
vrt%d|�d|�d
|�d������dS)aZ
        Create a pytables index on the specified columns.

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

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

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

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

        Notes
        -----
        Cannot index Time64Col or ComplexCol.
        Pytables must be >= 3.0.
        NFTc�*�g|]}|j�	|j��Sr�)r(r,r�s  r\rvz&Table.create_index.<locals>.<listcomp>�s"��I�I�I�1�Q�5H�I�q�w�I�I�Ir^r�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.rrozcolumn 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�)rKr�rWrxrwr�r�r�r�r�r�r��remove_indexrr�r�r�rbr�)r�r�r�r��kwr�r�r�r��cur_optlevel�cur_kinds           r\r�zTable.create_index�s���<��� � �	��F��e����F��?�g��o�o�I�I��	�I�I�I�G��'�E�4�=�1�1�	 ��i�G�
����%�B�z�N����B�v�J��
���$	�$	�A���
�A�t�,�,�A��}��<�
6��G�E�#(�>�L�$�z�H��'�H��,<�,<����(�(�(�(�%-��6�
��+���0H�0H����(�(�(�(�)5��:���|�	)��v�(�(��3�3��'�H����#�A�N�(�(�R�(�(�(���d�)�!�,�Q�/�/�/�$�U�a�U�U�/0�U�U�12�U�U�U����0�=$	�$	r^r�r�r��9list[tuple[np.ndarray, np.ndarray] | tuple[Index, Index]]c��t||||���}|���}g}|jD]Y}|�|j��|�||j|j|j���}|�	|���Z|S)a
        Create the axes sniffed from the table.

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

        Returns
        -------
        List[Tuple[index_values, column_values]]
        rPr)
�	Selectionr�r�r�r�ror�r_r�r�)	r�rzr�r��	selectionr�r#r��ress	         r\�
_read_axeszTable._read_axes%s���"�d�%�u�4�H�H�H�	��!�!�#�#������	 �	 �A�
�J�J�t�y�!�!�!��)�)�������{�	���C�
�N�N�3������r^r�c��|S)zreturn the data for this objr��r�r�r�s   r\�
get_objectzTable.get_objectGs	���
r^c�����t|��sgS|d\}�|j�|i��}|�d��dkr|rtd|�d|�����|durt	���}n|�g}t|t��rQt|���t	|��}|��fd�|�	��D�����fd	�|D��S)
zd
        take the input data_columns and min_itemize and create a data
        columns spec
        rrr/z"cannot use a multi-index on axis [z] with data_columns TNc�(��g|]}|dk�|�v�|��Srqr�)rsr[�existing_data_columnss  �r\rvz/Table.validate_data_columns.<locals>.<listcomp>hs7��������H�}�}��2G�)G�)G��)G�)G�)Gr^c���g|]}|�v�|��	Sr�r�)rsr��axis_labelss  �r\rvz/Table.validate_data_columns.<locals>.<listcomp>ps#���<�<�<�a�1��+;�+;��+;�+;�+;r^)
ryr�r�r�rwrWr�r�r�r&)r�r�r�rbrgr�rprns      @@r\�validate_data_columnszTable.validate_data_columnsLsG����
�>�"�"�	��I�*�1�-���k��y�}�}�T�2�&�&���8�8�F���|�+�+��+��/�T�/�/� ,�/�/���
��4�����,�,�L�L�
�
!��L��l�D�)�)�		�$'��$5�$5�!���-�-�L��������)�.�.�0�0����
�
�
�=�<�<�<�<�<�<�<�<r^r,rc����t�t��s/|jj}t	d|�dt����d������dg��fd��D���|���r/d}d�|jD���t|j	��}|j
}nd	}|j}	|jd
ksJ�t���|jdz
krtd���g}
|�d
}t�fd�dD����}�j|}t|��}
|r�t|
��}|j|d}t%t'j|
��t'j|��dd���sSt%t'jt+|
����t'jt+|����dd���r|}
|	�|i��}t|j��|d<t|��j|d<|
�||
f���d}�j|}��|��}t7|||j|j��}||_|�d��|� |	��|�!|��|g}t|��}|dksJ�t|
��dksJ�|
D]}tE�|d|d���� |jdk}|�#|||
��}|�$�|���%��}|�&|||
|j'|��\}}g}tQtS||����D�]/\}\}}tT}d}|rRt|��dkr?|d|vr5tV}|d}|�$t|tX��std���|rF|rD	|j'|}n7#tZt\f$r!} td|�d|j'�d���| �d} ~ wwxYwd}|pd|��}!t_|!|j0||||j|j|���}"tc|!|j2��}#|�3|"��}$ti|"j5j6��}%d}&to|"dd���tq|"j9��}&dx}'x}(})t|"j5tt��r5|"j;})d}'t'j<|"j=���>��}(n.t|j5t~��rtY|j5��}'t�|"��\}*}+||#|!t|��|$||%|&|)|'|(|+|*���},|,� |	��|�|,��|dz
}��1d�|D��}-t|��|jA|j|j|j||
||-|	|��
�
}.t�|d��r|jC|._C|.�D|��|r|r|.�E|��|.S)a0
        Create and return the axes.

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

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

        min_itemsize: Dict[str, int] or None, default None
            The min itemsize for a column in bytes.
        z/cannot properly create the storer for: [group->r�r\Nrc�:��g|]}��|����Sr�)�_get_axis_number)rsr�r�s  �r\rvz&Table._create_axes.<locals>.<listcomp>�s'���6�6�6�A��$�$�Q�'�'�6�6�6r^Tc��g|]	}|j��
Sr�r�r�s  r\rvz&Table._create_axes.<locals>.<listcomp>�s��4�4�4�q�A�F�4�4�4r^Fr3roz<currently only support ndim-1 indexers in an AppendableTableric3�$�K�|]
}|�v�|V��dSrdr�)rsr_r�s  �r\r�z%Table._create_axes.<locals>.<genexpr>�s'�����6�6����
�
�1�
�
�
�
�6�6r^r.r�r�rr"zIncompatible appended table [z]with existing table [�
values_block_)�existing_colr�r�r_r�r�r*r�)rjr,r�r.r/r�r*r�r�r0r_r�c�*�g|]}|j�	|j��Sr�)r(rj)rsr{s  r\rvz&Table._create_axes.<locals>.<listcomp>Ks"��B�B�B�C�C�,A�B�s�x�B�B�Br^)
r�r�r_r�r�rbr�r�r�r�r�)FrWr,r�r�r�rrKr�rwr�r�r�r�ryr�r�r�rbr+rXr=r�r�r�rr��_get_axis_namer�r_r�rgr1r�r��
_reindex_axisrqrkri�_get_blocks_and_itemsr�r�ror�r rb�
IndexErrorr��_maybe_convert_for_string_atomr�rRr4r�r�r_rjr�r�r*r'r�rr
rr3r�r�rRr�rOr)/r�r�r�rr�r�r�r��table_exists�new_info�new_non_index_axesr�r��append_axis�indexer�
exist_axisr��	axis_name�	new_index�new_index_axes�jr�r�r�r��vaxesr�r��b_itemsrSrjrxr��new_name�data_convertedrTr.r�r*r�r0r�r�r�r{�dcs�	new_tables/ ``                                            r\�_create_axeszTable._create_axesrs:����@�#�y�)�)�	��J�&�E��'�%�'�'��s�)�)�'�'�'���
��<��3�D�7�6�6�6��6�6�6���?�?���	!��L�4�4�D�O�4�4�4�D��� 1�2�2�L��l�G�G�!�L��9���y�A�~�~�~�~��t�9�9��	�A�
�%�%��N���
�
$&���?��G��6�6�6�6�f�6�6�6�6�6���H�S�M���1�g�g���	-��,�-�-�G��,�W�5�a�8�J�#����%�%����$�$�� �	���

-�$��H�V�K�0�0�1�1��H�V�J�/�/�0�0�#� $�	���-�#-�K��"�"�3��+�+���Q�W�
�
��W�
��A�w�w�'��V���!�!�3��"4�5�5�5��1�g���H�S�M���&�&�s�+�+�	�"�9�a�����L�L�	��	��	���!�������h�'�'�'�� � ��.�.�.�#���������A�v�v�v�v��%�&�&�!�+�+�+�+�#�	1�	1�A���Q�q�T�1�Q�4�0�0�C�C��^�q�(�
��1�1��,�(:�
�
������Z�0�0�=�=�?�?�� �6�6��<�!3�T�5E�|�
�
���	�
��!*�3�v�y�+A�+A�!B�!B�K	�K	��A�~��W��E��D��
V��G���� 1� 1�g�a�j�L�6P�6P�(���q�z����
�4��(=�(=��$�%T�U�U�U��	
$��	
$��#'�#3�A�#6�L�L��"�H�-����$�D��D�D�04�0@�D�D�D������������� $���2�2�q�2�2�H�;���
�)�)�����{��	�	�	�N�*�(�D�L�A�A�H��/�/�.�1�1�C�!�.�"6�";�<�<�D��B��~�t�T�2�2�>��^�.�/�/��(,�,�D�,�8�g��.�.�0@�A�A�
&�(�0��!���:�n�&?�@�@�F�F�H�H����C�I�{�3�3�
&��3�9�~�~��7��G�G��D�*��%����G�}�}�������!� ��
�
�
�C�
�O�O�H�%�%�%��L�L�����
��F�A�A�B�B�5�B�B�B���D��J�J��;��*��]��;�%�-�����
�
�
�	��4��"�"�	+�#�{�I���'�'��5�5�5��	%��	%����t�$�$�$��s�5
P�P5�P0�0P5r�rc��t|jt��r|�d��}d�}|j}t	t
|��}t
|j��}||��}t|��r�|d\}	}
t|
���
t|����}|�||	���j}t	t
|��}t
|j��}||��}|D]l}|�|g|	���j}t	t
|��}|�|j��|�||�����m|r�d�t||��D��}
g}g}|D]�}t|j��}	|
�|��\}}|�|��|�|���Z#t$t&f$r8}d�d�|D����}t+d|�d	���|�d}~wwxYw|}|}||fS)
Nr�c�*���fd��jD��S)Nc�N��g|]!}�j�|j����"Sr�)r.r�r�)rsr��mgrs  �r\rvzFTable._get_blocks_and_items.<locals>.get_blk_items.<locals>.<listcomp>ss)���G�G�G�S�C�I�N�N�3�<�0�0�G�G�Gr^)r�)r�s`r\�
get_blk_itemsz2Table._get_blocks_and_items.<locals>.get_blk_itemsrs���G�G�G�G�C�J�G�G�G�Gr^rr�c�\�i|])\}}t|�����||f��*Sr�)rx�tolist)rs�br�s   r\r�z/Table._get_blocks_and_items.<locals>.<dictcomp>�sD������A�w��g�n�n�&�&�'�'�!�W����r^r;c�,�g|]}t|����Sr�r@)rs�items  r\rvz/Table._get_blocks_and_items.<locals>.<listcomp>�s ��&L�&L�&L�d�|�D�'9�'9�&L�&L�&Lr^z+cannot match existing table structure for [z] on appending data)rWr�r@r�r
rArwr�ryr.r�r�r�rorxr�rrr�r}r�rAr�)r�rr�r�r�r�r�r�r�rgrp�
new_labelsr��by_items�
new_blocks�
new_blk_items�ear.r�r�r��jitemss                      r\r|zTable._get_blocks_and_itemsds����e�j�,�/�/�	/��%�%�g�.�.�E�	H�	H�	H��j���<��%�%��"�3�:�.�.��!.��s�!3�!3�	��|���	5�
!3�1� 5��D�+��{�+�+�6�6�u�\�7J�7J�K�K�J��-�-�
��-�6�6�;�C��|�S�)�)�C��#�*�%�%�F�%�
�c�*�*�I�!�
5�
5���m�m�Q�C�d�m�3�3�8���<��-�-���
�
�c�j�)�)�)�� � ���s�!3�!3�4�4�4�4��	&���"%�f�i�"8�"8����H�')�J��M�!�
�
���b�i�(�(��	�!)���e�!4�!4�J�A�w��%�%�a�(�(�(�!�(�(��1�1�1�1��"�H�-���� �X�X�&L�&L�e�&L�&L�&L�M�M�F�$�,�f�,�,�,������������� �F�%�I��y� � s�/AG2�2H;�3H6�6H;rfrec�p���|�t|��}|�G�jr@t�jt��sJ��jD]}||vr|�d|����jD]\}}t
�|||�����fd�}�|j�-|j���D]\}}	}
|||
|	�����S)zprocess axes filtersNrc�L���jD�]}��|��}��|��}|�J�||krX�	jr'|�t�	j����}|||��}��|���|cS||vrutt�|��j
��}t|��}t�t��rd|z
}|||��}��|���|cS��
td|�d����)Nr�rozcannot find the field [z] for filtering!)�_AXIS_ORDERSrt�	_get_axisr�unionr.r�r�r?r�r�rWr,r�)
�field�filt�opr��axis_number�axis_values�takersr�r�r�s
        ��r\�process_filterz*Table.process_axes.<locals>.process_filter�sO���!$�!1�A�A�I�"%�"6�"6�y�"A�"A�K�"%�-�-�	�":�":�K�&�2�2�2��	�)�)� �.�B�#'�:�:�e�D�K�.@�.@�#A�#A�D�!#��K��!6�!6��"�w�w�K�w�8�8��@�@�@�@��+�-�-�!-�g�c�5�.A�.A�.H�!I�!I��+�D�1�1��&�c�9�5�5�:�*+�k�/�K�!#��F�D�!1�!1��"�w�w�K�w�8�8��@�@�@�@�.�!�!R�5�!R�!R�!R�S�S�Sr^)	rwrrWr��insertrbr{�filterr�)r�r�rfr�rrg�labelsr�r�r�r�s``         r\�process_axeszTable.process_axes�s�������7�m�m�G���4�#6���d�k�4�0�0�0�0�0��[�
)�
)���G�#�#��N�N�1�a�(�(�(��!�/� 	T� 	T�L�D�&���T�6�7�;�;�C�
T�
T�
T�
T�
T�
T�
T�@��'�#,�#3�#:�#:�#<�#<�
6�
6���r�4�$�n�U�D�"�5�5����
r^r�r�r�c��|�t|jd��}d|d�}d�|jD��|d<|r<|�	|jpd}t	���|||p|j���}||d	<n|j�
|j|d	<|S)
z:create the description of the table from the axes & valuesNi'r�)rjr�c�(�i|]}|j|j��Sr�)r,r.r�s  r\r�z,Table.create_description.<locals>.<dictcomp>�s��>�>�>�q�A�G�Q�U�>�>�>r^rx�	)r�r�r�r�)�maxrr�r�r�r1r�r�)r�r�r�r�r�r�r�s       r\�create_descriptionzTable.create_description�s������t�2�E�:�:�L��l�;�;��?�>�D�I�>�>�>��-���
	)�� � �O�0�q�	��i�i�'�'�#��%�9��)9�(���G�
#�A�i�L�L�
�]�
&��=�A�i�L��r^c��|�|��|���sdSt||||���}|���}|j��|j���D]|\}}}|�||���|���dz���}	|||	j	||���z
|��j
}�}t|��S)zf
        select coordinates (row numbers) from a table; return the
        coordinates object
        FrPNror�)r`rKre�
select_coordsr�r�rWrr��ilocr�r.)
r�rzr�r�rf�coordsr�r�r�r�s
          r\rRzTable.read_coordinates�s���	
���e�$�$�$���� � �	��5��d�%�u�4�H�H�H�	��(�(�*�*����'�#,�#3�#:�#:�#<�#<�
S�
S���r�4��'�'�������F�J�J�L�L�1�4D�(���� ���4�9�V�f�j�j�l�l�-B�#C�T� J� J� Q�R����V�}�}�r^rUc�`�|���|���sdS|�td���|jD]�}||jkr�|jst
d|�d����t|jj	|��}|�
|j��|�|||�|j
|j|j���}t!|d|j��}t|jj|�d�d��}	t'||d|	�	��cS��t)d|�d
����)zj
        return a single column from the table, generally only indexables
        are interesting
        FNz4read_column does not currently accept a where clausezcolumn [z=] can not be extracted individually; it is not data indexablerror�)rjr�r_z] not found in the table)r`rKr�r�rjr(r�r�r�r�r�r�ror�r_r�rjr*rtr2r�)
r�rUrzr�r�r�r��
col_values�cvsr_s
          r\rWzTable.read_columnsh��	
��������� � �	��5����R�S�S�S���	I�	I�A�������*��$�3�6�3�3�3�����D�J�O�V�4�4���
�
�4�9�%�%�%��Y�Y��e�D�j�M� �L�!�]��;�	'���
��j��m�Q�T�2�2����
� 0�V�2B�2B�2B�D�I�I���c��U�%�H�H�H�H�H�H�% �(�B�&�B�B�B�C�C�Cr^)Nr�NNNNNN)r�r�r�rKr_r`r�rbr�r�rbr�r�r�r�r�r�r�rar�r)r�rbrr)r�r�rarr)rar )rar')rar,)rar)r�rbrarb)r�rbr�rSrar�rrdr)r�r`rar�r)r�r�r�r�rarc�r�r�)TNNN)r�r,rr�)r�r,rr�)rfrerar,)r�r�r�r�r�r�rar,ri)rUrbr�r�r�r�)4rrrrr,r-rr�rpr�rr�r
r�rrrrrrYr�r_rxr�rr&r+r7r;r>r@r�r�rSrVr`rOrrJr�rhrrkrqr��staticmethodr|r�r�rRrWrrs@r\r#r#U
s�����������.�K��K������O�O�O�#$�F�$�$�$�$��H��N�N�N� $��,0�;?�,0�$(� ���������*�-�-�-��X�-�
�
�
�
�$����%�%�%�%�N�-�-�-��X�-�!�!�!�!�"�F�F�F��X�F��%�%�%��X�%��2�2��X�2�����X��� � ��X� ��&�&��X�&��B�B�B��X�B��<�<�<��X�<������X���
�
�
��X�
�"�"�"�"�<�<�<�
3�3�3�3�*�*�*�*�

�
�
�
�$����$�$�$�$�
Q�
Q�
Q�
Q�	�	�	�	�	�����*�I�I��^�I�X?C�T�T�T�T�T�nCG� � � � � �D�����[��$=�$=�$=�T����p�p�p�p�p�d�A!�A!�A!��\�A!�F5�5�5�5�5�n����@HL������:� ��+D�+D�+D�+D�+D�+D�+D�+D�+Dr^r#c�0�eZdZdZdZ				ddd�Zd
d
�ZdS)r�z�
    a write-once read-many table: this format DOES NOT ALLOW appending to a
    table. writing is a one-time operation the data are stored in a format
    that allows for searching the data on disk
    r�Nr�r�r�c� �td���)z[
        read the indices and the indexing array, calculate offset rows and return
        z!WORMTable needs to implement readrcrds     r\rCzWORMTable.readOs��"�"E�F�F�Fr^rar�c� �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 writercrfs   r\rzWORMTable.write[s��"�"F�G�G�Gr^rhrir)rrrrr�rCrr�r^r\r�r�Fsk���������J��� ��
G�
G�
G�
G�
G�H�H�H�H�H�Hr^r�c�T�eZdZdZdZ												ddd�Zddd�Zdd�Zd d!d�ZdS)"r��(support the new appendable table formats�
appendableNFTr�r�r�r�r�rvrar�c��|s'|jr |j�|jd��|�||||||���}|jD]}|����|jsJ|�||||	���}|���|
|d<|jj	|jfi|��|j
|j_
|jD]}|�||���|�
||
���dS)Nr�)r�r�rr�r�r�)r�r�r�r�rv)r�)rr�rr�r�r�r�r�rS�create_tabler�rtr��
write_data)r�r�r�r�r�r�r�r�r�r�r�r�r�rvr�r��optionss                 r\rzAppendableTable.writejsM�� �	:�$�.�	:��L�$�$�T�Z��9�9�9��!�!����%��%�
"�
�
����	�	�A�
���������	?��.�.��#�%�)�	/���G�
�O�O����%0�G�M�"�
'�E�M�&�u�{�>�>�g�>�>�>�!�:������	.�	.�A�
���u�f�-�-�-�-�	����6��2�2�2�2�2r^c�N���|jj}|j}g}|rv|jD]n}t	|j���d���}t|tj	��r*|�
|�dd������ot|��r/|d}|dd�D]}||z}�|�
��}nd}d�|jD��}	t|	��}
|
dks
J|
���d	�|jD��}d
�|D��}g}t|��D]L\}
}|f|j||
|
zjz}|�
|�|�����M|�d}tjt'||��|j���}||zdz}t)|��D]e}
|
|z�t'|
dz|z|�����krdS|�|��fd
�|	D��|�
|���nd��fd�|D������fdS)z`
        we form the data into a 2-d including indexes,values,mask write chunk-by-chunk
        rr��u1FrroNc��g|]	}|j��
Sr�)r~r�s  r\rvz.AppendableTable.write_data.<locals>.<listcomp>�s��6�6�6��1�9�6�6�6r^c�6�g|]}|�����Sr�)rrr�s  r\rvz.AppendableTable.write_data.<locals>.<listcomp>�s ��:�:�:�A�!�+�+�-�-�:�:�:r^c	��g|]I}|�tjtj|j��|jdz
������JSr�)�	transposerX�roll�aranger�rs  r\rvz.AppendableTable.write_data.<locals>.<listcomp>�sB��V�V�V�!�!�+�+�b�g�b�i���&7�&7���!��D�D�E�E�V�V�Vr^rrc�$��g|]}|�����
Sr�r�)rsr��end_i�start_is  ��r\rvz.AppendableTable.write_data.<locals>.<listcomp>�s"���;�;�;�a��7�5�=�)�;�;�;r^c�$��g|]}|�����
Sr�r�)rsr�r�r�s  ��r\rvz.AppendableTable.write_data.<locals>.<listcomp>�s"���:�:�:�Q��'�%�-�(�:�:�:r^)�indexesrr�)r_r�rr�r6r�r�rWrXrdr�rryrr�r�r��reshaper�rr��write_data_chunk)r�r�r�r�rI�masksr�rr�r��nindexesr��bvaluesr�r��	new_shape�rows�chunksr�r�s                  @@r\r�zAppendableTable.write_data�s������
� ���#�����	@��%�
@�
@���A�F�|�|�'�'�Q�'�/�/���d�B�J�/�/�@��L�L����T���!>�!>�?�?�?���u�:�:�	���8�D��1�2�2�Y�
 �
 ���a�x����:�:�<�<�D�D��D�7�6�d�o�6�6�6���w�<�<���1�}�}�}�h�}�}�}�;�:��)9�:�:�:��V�V�v�V�V�V�����f�%�%�	1�	1�D�A�q���4�:�e�H�q�L�.A�#B�#H�H�I��N�N�1�9�9�Y�/�/�0�0�0�0����I��x��I�u�-�-�T�Z�@�@�@���)�#�a�'���v���	�	�A��)�m�G���Q��)�+�U�3�3�E��%�������!�!��;�;�;�;�;�7�;�;�;�,0�,<�T�'�%�-�(�(�$�:�:�:�:�:�'�:�:�:�	
"�
�
�
�
�
	�	r^r�rSr��list[np.ndarray]r�npt.NDArray[np.bool_] | Noner�c��|D]}tj|j��sdS�|djd}|t|��krtj||j���}|jj}t|��}t|��D]\}	}
|
|||	<�t|��D]\}	}||||	|z<�|�K|����	td���}|���s||}t|��r5|j�
|��|j���dSdS)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
        NrrFr)rXr�r�ryr�r_r�r�rrr�r�r�r�r9)r�r�r�rr�r�rIr�r�r�r�r�s            r\r�z AppendableTable.write_data_chunk�sm�� �	�	�A��7�1�7�#�#�
����
���
� ��#���C��I�I����8�E���4�4�4�D��
� ���w�<�<�� ��(�(�	!�	!�F�A�s� �D��q��N�N��f�%�%�	*�	*�D�A�q�()�D��q�8�|�$�%�%��������$�$�T��$�6�6�6�A��5�5�7�7�
��A�w���t�9�9�	��J���d�#�#�#��J��������	�	r^r�r�c�B�|�t|��sm|�+|�)|j}|j�|jd���n>|�|j}|j�||���}|j���|S|���sdS|j}t||||���}|�
��}t|d������}t|��}	|	�r'|�
��}
t|
|
dkj��}t|��sdg}|d|	kr|�|	��|ddkr|�dd��|���}t'|��D]c}
|�t+|
|����}|�||jd||jddz���|
}�d|j���|	S)	NTr|r�Frrorr	)ryrIr�rr�r��remove_rowsr9rKrer�r2�sort_values�diffrwr�r�r�rr�reversedr�r�)r�rzr�r�rIr�rfr��
sorted_series�lnr�r��pgr-r�s               r\r�zAppendableTable.deletes(���=��E�
�
�=��}����
����(�(���t�(�D�D�D�D��<��:�D��
�.�.�U��.�F�F���
� � �"�"�"��L���� � �	��4��
���d�E��T�B�B�B�	��(�(�*�*���v�E�2�2�2�>�>�@�@�
�
��
�
��
�	� �%�%�'�'�D��$�t�a�x�.�.�/�/�F��v�;�;�
�����b�z�R����
�
�b�!�!�!��a�y�A�~�~��
�
�a��#�#�#������B��f�%�%�
�
��$�)�)�%��2�,�,�7�7���!�!��t�z�!�}�-�D���B��4H�1�4L�"��������J�������	r^)NFNNNNNNFNNT)
r�r�r�r�r�r�rvr�rar�r)r�r�r�r�rar�)
r�rSr�r�rr�r�r�rar�rri)	rrrrr�rr�r�r�r�r^r\r�r�ds�������2�2��J������� $����� �93�93�93�93�93�v9�9�9�9�9�v*�*�*�*�X8�8�8�8�8�8�8r^r�c�p�eZdZUdZdZdZdZeZde	d<e
dd	���Zedd���Z
				ddd�ZdS)r�r�r�r�r3r.r/rar�c�.�|jdjdkS)Nrro)r�rgr�s r\r&z"AppendableFrameTable.is_transposedOs����q�!�&�!�+�+r^r�c��|r|j}|S)zthese are written transposed)r�rjs   r\rkzAppendableFrameTable.get_objectSs���	��%�C��
r^Nr�r�r�c�0����|������sdS��|||���}t�j��r,�j��jddi��ni}�fd�t�j��D��}t|��dksJ�|d}||d}	g}
t�j��D�]�\}}|�j	vr�||\}
}|�d��dkrt|
��}ntj|
��}|�d��}|�|�
|d�	���jr%|}|}t|	t|	d
d�����}n)|j}t|	t|	d
d�����}|}|jdkr<t%|t&j��r"|�d|jdf��}t%|t&j��r�	t/|j||d�
��}n�#t0$r�}�jdkrkt5d��r\t7|���d��r:t:r3t/|j||dt=dt&j������}n�Yd}~nHd}~wwxYwt%|t��rt/|||���}nt/j |g||���}tC��r|j"j#dks8|j$|j"k�%��sJ|j$|j"f���|D]B}t�j&j'|�d�d��}|dvr||�(|��||<�C|
�)|�����t|
��dkr	|
d}ntU|
d���}tW�|||���}��,|||���}|S)NrPrc�8��g|]\}}|�jdu�|��Srar:)rsr�r�r�s   �r\rvz-AppendableFrameTable.read.<locals>.<listcomp>ps.���P�P�P�e�a��r�T�_�Q�=O�7O�7O��7O�7O�7Or^rorr/r�T��inplacerjriFr�r\r]r^r`ra)r�r�r�r_r�r
r�)rbr�r�)rfr�)-r`rKrhryrbr�r�r�r�r�r.r/�from_tuples�	set_namesr&r�r�r�rWrXrdr�r�r,rhr�rrbr	rr3ri�_from_arraysrr_r��dtypesr�r�rtrr�r5rer�)r�rzr�r�r�rr��inds�indr��framesr�r��
index_valsr~r�r�r��index_�cols_r�r�rUr_rfs`                        r\rCzAppendableFrameTable.readZs`���	
���e�$�$�$���� � �	��4����u�E���E�E���4�&�'�'�
�D�I�M�M�$�-�a�0��3�R�8�8�8��	
�Q�P�P�P�y���3�3�P�P�P���4�y�y�A�~�~�~�~��1�g���s��A������d�i�(�(�=	�=	�D�A�q���(�(�(��"(��)��J���x�x����<�/�/��Z�(�(���!�-�j�9�9���H�H�W�%�%�E�� ����u�d��3�3�3��!�
� �����e�'�%���*F�*F�G�G�G��� ����u�7�5�&�$�+G�+G�H�H�H�����{�a���J�v�r�z�$B�$B������F�L��O�(<�=�=���&�"�*�-�-�
S��"�6�8�U�&�u�U�U�U�B�B��)�������6�6�&�'<�=�=�7���H�H�-�-�.F�G�G�7�(�7�
'�"�H�$)�"(�!&�"-�h���"P�"P�"P�������������������� �F�E�*�*�
S��v�u�F�C�C�C����+�V�H�e�6�R�R�R��&�(�(�
T�V�\�->�#�-E�-E��	�V�\�1�6�6�8�8�S�S�2�9�f�l�:S�S�S�8� �
:�
:����
� 0�V�2B�2B�2B�D�I�I���-�-�-�!#�F��!2�!2�5�!9�!9�B�v�J���M�M�"������v�;�;�!������B�B���Q�'�'�'�B��d�%�u�4�H�H�H�	�
�
�
�r�Y��
�
H�
H���	s�%H>�>
K	�A7K�K	rr�rhri)rrrrr,r�r�r,r/rrr&rrkrCr�r^r\r�r�Gs��������2�2��K�#�J��D�)2�H�2�2�2�2�
�,�,�,��X�,������[���� ��d�d�d�d�d�d�dr^r�c�|��eZdZdZdZdZdZeZe	dd���Z
edd	���Zdd�fd�
Z
				dd�fd�
Z�xZS)r�r�r�r�r3rar�c��dSr�r�r�s r\r&z#AppendableSeriesTable.is_transposed�r�r^r�c��|Srdr�rjs   r\rkz AppendableSeriesTable.get_object�s���
r^Nr�c����t|t��s|jpd}|�|��}t	��jd||j���d�|��dS)�+we are going to write this as a frame tabler��r�r�Nr�)rWr,rj�to_framer�rr�r�)r�r�r�r�rjr�s     �r\rzAppendableSeriesTable.write�si����#�y�)�)�	%��8�'�x�D��,�,�t�$�$�C�����
�K�#�C�K�,>�,>�,@�,@�K�K�F�K�K�K�K�Kr^r�r�r�r2c�j��|j}|�B|r@t|jt��sJ�|jD]}||vr|�d|���t���||||���}|r|�|jd���|jdd�df}|j	dkrd|_	|S)NrrfTr�r�)
rrWr�rwr�r�rC�	set_indexr�rj)	r�rzr�r�r�rrr[r�s	        �r\rCzAppendableSeriesTable.read�s�����,����>���d�k�4�0�0�0�0�0��[�
)�
)���G�#�#��N�N�1�a�(�(�(���G�G�L�L�u�g�U��L�N�N���	3�
�K�K���T�K�2�2�2�
�F�1�1�1�a�4�L��
�6�X����A�F��r^rr�rdrrhr�)rrrrr,r�r�r2r/rr&rrkrrCrrs@r\r�r��s��������2�2� �K�$�J��D��H�
�����X�������[��L�L�L�L�L�L�L��� ������������r^r�c�,��eZdZdZdZdZd�fd�Z�xZS)r�r�r�r�rar�c�<��|jpd}|�|��\}|_t|jt��sJ�t	|j��}|�|��t
|��|_t��j	dd|i|��dS)r�r�r�Nr�)
rjrr�rWrwr�r.r�r�r)r�r�r�rj�newobjr�r�s      �r\rz AppendableMultiSeriesTable.write�s�����x�#�8��"�6�6�s�;�;������$�+�t�,�,�,�,�,��D�K� � �����D�����t���������
�+�+�&�+�F�+�+�+�+�+r^r)rrrrr,r�rrrs@r\r�r��sM�������2�2� �K�)�J�,�,�,�,�,�,�,�,�,�,r^r�c��eZdZUdZdZdZdZeZde	d<e
dd	���Ze
d
���Zdd�Z
ed
���Zdd�ZdS)r�z:a table that read/writes the generic pytables table formatr�r�r3zlist[Hashable]r�rarbc��|jSrd)r,r�s r\r�zGenericTable.pandas_type
s����r^c�<�t|jdd��p|jSrrr�s r\rYzGenericTable.storables���t�z�7�D�1�1�?�T�Z�?r^r�c��g|_d|_g|_d�|jD��|_d�|jD��|_d�|jD��|_dS)r�Nc� �g|]}|j�	|��Sr�rFr�s  r\rvz*GenericTable.get_attrs.<locals>.<listcomp>rGr^c� �g|]}|j�	|��Sr�rFr�s  r\rvz*GenericTable.get_attrs.<locals>.<listcomp>rIr^c��g|]	}|j��
Sr�rir�s  r\rvz*GenericTable.get_attrs.<locals>.<listcomp>s��>�>�>��Q�V�>�>�>r^)rbr�r�rJr�r�r�r�s r\rVzGenericTable.get_attrssf�� ���������K�K�d�o�K�K�K���P�P�t��P�P�P���>�>�T�-=�>�>�>����r^c
��|j}|�d��}|�dnd}tdd|j||���}|g}t	|j��D]x\}}t
|t��sJ�t||��}|�|��}|�dnd}t|||g||j||���}	|�
|	���y|S)z0create the indexables from the table descriptionr�Nr�r)rjrgr�r�r0)rjr/r�r.r�r�r0)rxr�r�r�r��_v_namesrWrbr�r)r�)
r�r�rUr�r[rZr�rr�r�s
          r\rJzGenericTable.indexabless��
���
�
�
��
(�
(���^�z�z���#��q��
���
�
�
�	�IR�{���a�j�)�)�	#�	#�D�A�q��a��%�%�%�%�%��1�a�=�=�D��#�#�A�&�&�B�!#��:�:�T�D�(����s���j������B�
���r�"�"�"�"��r^c� �td���)Nz cannot write on an generic tablerc)r�r�s  r\rzGenericTable.writeCs��!�"D�E�E�Er^Nrr)rrrrr,r�r�r,r/rrr�rYrVrrJrr�r^r\r�r�s��������D�D��K� �J��D��H�����
� � � ��X� ��@�@��X�@�?�?�?�?�� � ��^� �FF�F�F�F�F�Fr^r�c���eZdZdZdZeZdZej	d��Z
edd���Zdd�fd
�
Z
				dd�fd�
Z�xZS)r�za frame with a multi-indexr�r3z^level_\d+$rarbc��dS)N�appendable_multir�r�s r\r�z*AppendableMultiFrameTable.table_type_shortOs��!�!r^Nr�c�>��|�g}n|dur|j���}|�|��\}|_t	|jt
��sJ�|jD]}||vr|�d|���t��jd||d�|��dS)NTrr�r�)	r�r�rr�rWrwr�r�r)r�r�r�r�rr�s     �r\rzAppendableMultiFrameTable.writeTs�������L�L�
�T�
!�
!��;�-�-�/�/�L��3�3�C�8�8���T�[��$�+�t�,�,�,�,�,���	*�	*�A���$�$��#�#�A�q�)�)�)������
�C�#�L�C�C�F�C�C�C�C�Cr^r�r�r�c�����t���||||���}|��j��}|j��fd�|jjD����|_|S)Nrfc�L��g|] }�j�|��rdn|��!Srd)�
_re_levels�search)rsrjr�s  �r\rvz2AppendableMultiFrameTable.read.<locals>.<listcomp>ls2���W�W�W��T�_�+�+�D�1�1�
;�T�T�t�W�W�Wr^)r�rCrr�r�r�r�)r�rzr�r�r�r�r�s`     �r\rCzAppendableMultiFrameTable.read`ss�����W�W�\�\��w�e�$�\�
O�
O��
�\�\�$�+�
&�
&���8�%�%�W�W�W�W����W�W�W�
�
����	r^rrdrrhri)rrrrr�r,r/r��re�compilerrr�rrCrrs@r\r�r�Gs��������$�$�(�J��H��D����N�+�+�J�
�"�"�"��X�"�
D�
D�
D�
D�
D�
D�
D��� ������������r^r�r�r,rgrNr�r.c��|�|��}t|��}|�t|��}|�|�|��r|�|��r|St|�����}|�6t|������|d���}|�|��s8tdd��g|jz}|||<|jt|��}|S)NF)�sort)	r�r?�equals�uniquer��slicer�r�rx)r�rgr�rDr��slicers      r\r{r{rs���

���t�	�	�B�
�&�
!�
!�F�
���U�#�#��
�
����u�-�-�
�6�=�=��3D�3D�
��
�
�&�-�-�/�/�
*�
*�F����e�l�l�n�n�-�-�:�:�6��:�N�N���=�=����%�',�T�4�'8�'8�&9�C�H�&D����t���g�e�F�m�m�$���Jr^r*r�str | tzinfoc�.�tj|��}|S)z+for a tz-aware type, return an encoded zone)r�get_timezone)r*�zones  r\r�r��s���!�"�%�%�D��Kr^r��np.ndarray | Indexr�r-c��dSrdr��r�r*r�s   r\rjrj�s	���Cr^rSc��dSrdr�r%s   r\rjrj�s���Cr^�str | tzinfo | None�np.ndarray | DatetimeIndexc��t|t��r|j�
|j|ksJ�|j�|S|�|t|t��r|j}nd}|���}t|��}t||���}|�d���|��}n|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
    Nrirz�M8[ns]r)
rWr-r*rjrr]r|r}rXr)r�r*r�rjs    r\rjrj�s����&�-�(�(���y� �F�I��O�O�O�3��9� ��M�	�~��f�m�,�,�	$��;�D�D��D��\�\�^�^�F�
�R�
 �
 ���v�D�1�1�1���#�#�E�*�*�5�5�b�9�9���	�4���F�(�3�3�3���Mr^rjc��t|t��sJ�|j}t|��\}}t	|��}t
�|��}tj|j	d��s(t|j	��st|j	��r4t||||t|dd��t|dd��|���St|t��rtd���tj|d���}	t#j|��}
|	dkr\t#jd	�|
D��t"j�
��}t||dt)�����|���S|	dkrPt-|
||��}|j	j}t||dt)���|��|���S|	d
vrt|||||���St|t"j��r|j	t4ksJ�|dks
J|���t)�����}t|||||���S)N�iur)r*)r�r�r.r)r*r+zMultiIndex not supported here!Fr�rc�6�g|]}|�����Sr�)�	toordinalrs  r\rvz"_convert_index.<locals>.<listcomp>�s ��>�>�>�!����
�
�>�>�>r^r)r+r�)�integer�floating)r�r�r.r+rE)rWrbrjr�r�r r�rrgr_r&r"r&r�r/r�r�rXr�int32r��	Time32Col�_convert_string_arrayr3r�rdrEr�)rjr�r_r�r+rr�r�r�r�r�r3s            r\r�r��s~���d�C� � � � � ���J�5�U�;�;��I�z��*�%�%�D��%�%�i�0�0�D�	����T�*�*�
��u�{�+�+�
����%�%�
����������-�-��u�d�D�)�)�!�
�
�
�	
��%��$�$�:��8�9�9�9��O�E�%�8�8�8�M��Z��
�
�F������J�>�>�v�>�>�>�b�h�O�O�O�	���)�V�W�Y�Y�%8�%8�%:�%:�z�
�
�
�	
�
�(�	"�	"�)�&�(�F�C�C�	��?�+�������I�I����)�)�!�
�
�
�	
�
�1�	1�	1�����4�J�
�
�
�	
��)�R�Z�0�0�N�Y�_��5N�5N�5N�N��x���������y�y�#�#�%�%����i��t�
�K�K�K�Kr^r�c�Z�|�d��r9|dkrt|��}n�t|�|����}n�|dkrt|��}n�|dkr\	t	jd�|D��t���}n�#t$r(t	jd�|D��t���}YnhwxYw|dvrt	j|��}nK|dvrt|d||�	��}n3|d
krt	j|d��}ntd|�����|S)
Nr�r�rc�6�g|]}tj|����Sr�rrs  r\rvz$_unconvert_index.<locals>.<listcomp>s#��B�B�B��� 0�� 3� 3�B�B�Br^rc�6�g|]}tj|����Sr�rrs  r\rvz$_unconvert_index.<locals>.<listcomp>s#��D�D�D�!�� 2�1� 5� 5�D�D�Dr^)r/�floatr�r�rrErzunrecognized index type )	r�r-r�r4rXrrEr�r)r�r�r_r�r�s     r\r�r�sd�����|�$�$�<��<���!�$�'�'�E�E�!�$�)�)�D�/�/�2�2�E�E�	
��	�	��t�$�$���	
����	T��J�B�B�T�B�B�B�&�Q�Q�Q�E�E���	T�	T�	T��J�D�D�t�D�D�D�F�S�S�S�E�E�E�	T����	
�-�	-�	-��
�4� � ���	
�(�	�	�'��$��&�
�
�
���
��	�	��
�4��7�#�#����:�D�:�:�;�;�;��Ls�,%B�/C�Cr�rMrc���t|jt��r|���}|jtkr|Sttj|��}|jj}tj
|d���}	|	dkrtd���|	dkrtd���|	dks|dks|St|��}
|�
��}|||
<|r;|
���r't|��|jkrt#d	���tj
|d���}	|	dkrwt%|jd
��D]\}||}
tj
|
d���}	|	dkr6t|��|kr||nd|��}td|�d
|	�d�����]t)|||���|j��}|j}t|t,��r9t/|�|��p|�d��pd
��}t3|pd
|��}|�|�|��}|�||kr|}|�d|��d���}|S)NFr�rz+[date] is not implemented as a table columnrlz>too many timezones in this block, create separate data columnsr�rEz8NaN representation is too large for existing column sizerzNo.rz2]
because its data contents are not [string] but [rr�z|Sr)rWr_r3r�rEr
rXrdrjrr�r�r6r�rryr3r�r�r�r3r�r�rmr�r�r�r)rjr�rxr�r�r_r�r�r�r�rr�r�r{�error_column_labelr�r3�ecis                  r\r~r~"s����'�-��-�-�%��"�"�$�$���}�������2�:�w�'�'�G���#�J��O�G�E�:�:�:�M������E�F�F�F��
�"�"��L�
�
�	
�
�X�%�%��x�)?�)?�����=�=�D��<�<�>�>�D��D��J��U����
�
�U�s�7�|�|�l�6K�'K�'K��S�T�T�T��O�D��7�7�7�M��� � ��t�z�!�}�%�%�		�		�A��q�'�C��O�C��>�>�>�M���(�(�36�w�<�<�!�3C�3C�W�Q�Z�Z��q���"��6�4F�6�6�%�6�6�6����)�+�4��6�B�B�J�J�4�:�V�V�N��&�H��,��%�%�V��<�+�+�D�1�1�T�\�5E�5E�h�5O�5O�T�ST�U�U���<�$�1�h�/�/�H����'�'��1�1���?�s�X�~�~��H�#�*�*�?��?�?��*�G�G�N��r^r�c��t|��rZt|���dd���j�||��j�|j��}t|�����}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]
    FrE)r�r_ro�Sr)ryr2rrb�encoderr�r�r!r��
libwriters�max_len_string_arrayrXr)r�r_r��ensuredr3s     r\r3r3qs��� �4�y�y�
��4�:�:�<�<�e�8�<�<�<�
����&�)�)�
�W�W�T�Z�(�(�	
��D�J�J�L�L�)�)�G��1�j�5�g�>�>�?�?�H�
�:�d�.�h�.�.�1�1�1�D��Kr^c�b�|j}tj|���t���}t|��r�t
jt|����}d|��}t|dt��rMt|d���j�
||d���}|���}d|j_n1|�|d����td���}|�d
}t
j||��|�|��S)a*
    Inverse of _convert_string_array.

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

    Returns
    -------
    np.ndarray[object]
        Decoded data.
    r�UrFrrE)r�r_TNri)r�rXrrrEryr>r?r!rWr�r2rbrZr��flags�	writeabler�!string_array_replace_from_nan_repr�)r�r�r_r�r�r3r_�sers        r\rr�s��&
�J�E�
�:�d�j�j�l�l�&�1�1�1�D�
�4�y�y�M��2�=��3F�3F�G�G���H�����d�1�g�u�%�%�	M���E�*�*�*�.�5�5���x�6���C��<�<�>�>�D�#'�D�J� � ��;�;�u�5�;�1�1�8�8��e�8�L�L�D������0��w�?�?�?��<�<����r^rkc��t|t��sJt|�����t|��rt	|||��}||��}|Srd)rWrbr�
_need_convert�_get_converter)r�rkr_r��convs     r\rfrf�sY���h��$�$�4�4�d�8�n�n�4�4�$��X�����h��&�9�9����f�����Mr^c�h�����dkrd�Sd�vr�fd�S�dkr��fd�Std������)Nr�c�.�tj|d���S)Nr*r�rXr)r_s r\r�z _get_converter.<locals>.<lambda>�s����A�X�6�6�6�r^c�0��tj|����S)NrrM)r_r�s �r\r�z _get_converter.<locals>.<lambda>�s�����A�T�2�2�2�r^r�c�*��t|d�����S)Nr)r)r_r_r�s ��r\r�z _get_converter.<locals>.<lambda>�s ���0�
�t�h�v�
�
�
�r^z
invalid kind )r�)r�r_r�s```r\rIrI�su������|���6�6�6�	��	�	�2�2�2�2�2�	
��	�	�
�
�
�
�
�	
��/��/�/�0�0�0r^c��|dvsd|vrdSdS)N)r�r�r�TFr�r�s r\rHrH�s"���'�'�'�<�4�+?�+?��t��5r^r4�
Sequence[int]c�(�t|t��st|��dkrtd���|ddkrN|ddkrB|ddkr6t	jd|��}|r|���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.rror2r3zvalues_block_(\d+)�values_)rWrbryr�rrr�)rjr4r��grps    r\rRrR�s����'�3���S�3�w�<�<�!�#3�#3��Q�R�R�R��q�z�Q���7�1�:��+�+���
�a����I�+�T�2�2���	#��(�(�*�*�Q�-�C�"�S�?�?�D��Kr^�	dtype_strc��t|��}|�d��rd}n�|�d��rd}n�|�d��rd}n�|�d��rd}n�|�d��r|}n�|�d��rd	}nm|�d
��rd
}nU|�d��rd}n=|�d��rd}n%|d
krd
}n|dkrd}ntd|�d����|S)zA
    Find the "kind" string describing the given dtype name.
    )r�r�r�r7r^)rmr�r/r��	timedeltar�r�r�r�rErbzcannot interpret dtype of [r\)r]r�r�)rVr�s  r\r�r��sc�� �	�*�*�I����/�0�0�E����	�	�	�g�	&�	&�E����	�	�	�i�	(�	(�E����	�	�	�o�	.�	.�E����	�	�	�l�	+�	+�E����	�	�	�k�	*�	*�E����	�	�	�f�	%�	%�E����	�	�	�j�	)�	)�
E����	�	�	�h�	'�	'�E����	�h�	�	����	�e�	�	�����C�y�C�C�C�D�D�D��Kr^c�|�t|t��r|j}t|jt��rd|jj�d�}n|jj}|jjdvr(tj	|�
d����}nt|t��r|j}tj	|��}||fS)zJ
    Convert the passed data into a storable form and a dtype string.
    r�r\�mMrW)
rWr7r�r_r(r�rjr�rXrr�r0r�)r�r�s  r\r�r�s����$��$�$���z���$�*�o�.�.�%�5�4�:�?�5�5�5�
�
��Z�_�
��z��$����z�$�)�)�D�/�/�*�*���
�D�+�	&�	&���y��
�:�d���D����r^c�4�eZdZdZ			ddd
�Zd�Zd�Zd
�ZdS)rez�
    Carries out a selection operation on a tables.Table object.

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

    Nr�r#r�r�r�rar�c��||_||_||_||_d|_d|_d|_d|_t|���r2tt��5tj|d���}|dvr�tj|��}|jtjkrA|j|j}}|�d}|�|jj}tj||��||_n�t'|jjtj��r^|j�||jk���s$|j�,||jk���rtd���||_ddd��n#1swxYwY|j�I|�|��|_|j�*|j���\|_|_dSdSdS)NFr�)r/�booleanrz3where must have index locations >= start and < stop)r�rzr�r��	conditionr��termsrlr$rr�rr�rXrr_�bool_rIr��
issubclassrr/r�generate�evaluate)r�r�rzr�r��inferreds      r\r�zSelection.__init__6s����
���
���
���	���������
��������	1��*�%�%�
1�
1��?�5��?�?�?���5�5�5��J�u�-�-�E��{�b�h�.�.�&*�j�$�)�t�� �=�$%�E��<�#'�:�#3�D�+-�9�U�D�+A�+A�%�+H��(�(�#�E�K�$4�b�j�A�A�1� �J�2���
�8J�7O�7O�7Q�7Q�2� �I�1�u��	�7I�6N�6N�6P�6P�1�",� U�#�#��,1��(�%
1�
1�
1�
1�
1�
1�
1�
1�
1�
1�
1����
1�
1�
1�
1�(��#����u�-�-�D�J��z�%�.2�j�.A�.A�.C�.C�+�������$�#�&�%s�DE0�0E4�7E4c�4�|�dS|j���}	t|||jj���S#t$rR}d�|�����}td|�d|�d���}t|��|�d}~wwxYw)z'where can be a : dict,list,tuple,stringN)r7r_r;z-                The passed where expression: a*
                            contains an invalid variable reference
                            all of the variable references must be a reference to
                            an axis (e.g. 'index' or 'columns'), or a data_column
                            The currently defined references are: z
                )	r�r7r;r_�	NameErrorrAr&rr�)r�rzrNr��qkeysr3s      r\rbzSelection.generatecs����=��4��J�!�!�#�#��	+���!�d�j�>Q�R�R�R�R���
	+�
	+�
	+��H�H�Q�V�V�X�X�&�&�E���.3���
DI������C��S�/�/�s�*�����
	+���s�;�
B�A
B�Bc�B�|j�C|jj�|j���|j|j���S|j�$|jj�|j��S|jj�|j|j���S)�(
        generate the selection
        Nr�)	r^r��
read_wherer�r�r�rlrRrCr�s r\r�zSelection.selectzs����>�%��:�#�.�.���%�%�'�'�t�z��	�/���
��
�
)��:�#�4�4�T�5E�F�F�F��z��$�$�4�:�D�I�$�F�F�Fr^c�>�|j|j}}|jj}|�d}n|dkr||z
}|�|}n|dkr||z
}|j�:|jj�|j���||d���S|j�|jStj	||��S)riNrT)r�r�r)
r�r�r�rIr^�get_where_listr�rlrXr�)r�r�r�rIs    r\r�zSelection.select_coords�s����j�$�)�t���
� ���=��E�E�
�Q�Y�Y��U�N�E��<��D�D�
�A�X�X��E�M�D��>�%��:�#�2�2���%�%�'�'�u�4�d�3���
��
�
)��#�#��y���%�%�%r^r)r�r#r�r�r�r�rar�)rrrrr�rbr�r�r�r^r\rere*sx������	�	�� ��+D�+D�+D�+D�+D�Z+�+�+�.
G�
G�
G�&�&�&�&�&r^re)r_r`rarb)rlrm)r�NNFNTNNNNr�rU)r�r�r�rbr�r�r�rbr�r�r�r`r�r�r�r`r�r�r�r�r�r�r�r�r�rbr_rbrar�)	Nr�r�NNNNFN)r�r�r�rbr�rbrzr�r�r�r�r�r�r�r�r�r�r�)r�rKr�rKrar�rd)r�r,rgrNr�r.rar,)r*rrarr)r�r#r*rr�r�rar-)r�r#r*r�r�r�rarS)r�r#r*r'r�r�rar()
rjrbr�r.r_rbr�rbrar&)r�rbr_rbr�rbrar#)rjrbr�rMr�r)r�rSr_rbr�rbrarS)r�rSrkrbr_rbr�rb)r�rbr_rbr�rb)r�rbrar�)rjrbr4rQrarb)rVrbrarb)r�rM)�r�
__future__r�
contextlibrr�rlrrrmr�r�textwrapr�typingrr	r
rrr
rr��numpyrX�pandas._configrrrr�pandas._libsrrr>�pandas._libs.libr�pandas._libs.tslibsr�
pandas.compatr�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/r0r1r2r3r4r5r6�pandas.core.arraysr7r8r9�pandas.core.arrays.string_r:�pandas.core.common�core�commonr�� pandas.core.computation.pytablesr;r<�pandas.core.constructionr=r�r>�pandas.core.indexes.apir?�pandas.core.internalsr@rA�pandas.io.commonrB�pandas.io.formats.printingrCrD�collections.abcrErFrG�typesrHr�rIrJrK�pandas._typingrLrMrNrOrPrQrRrSrTrFrer]rgrkrrr{r|rr}r~r�r�r�r��
config_prefix�register_option�is_bool�is_one_of_factoryr�r�r�r�r�r�r�rLr&r�r�r r)r+rkr�r�r�r#r�r�r�r�r�r�r�r{r�rjr�r�r~r3rrfrIrHrRr�r�rer�r^r\�<module>r�s�
�����#�"�"�"�"�"�����������������������	�	�	�	�	�	�	�	�����������������������������������������������������-�,�,�,�,�,�)�)�)�)�)�)�%�%�%�%�%�%�>�>�>�>�>�>�4�4�4�4�4�4���������������3�2�2�2�2�2�4�4�4�4�4�4�����������������������������8�7�7�7�7�7�������������������������������������
7�6�6�6�6�6� � � � � � � � � �����������������1�0�0�0�0�0���������
,�+�+�+�+�+���������
�,�����������
$�#�#�#�#�#�����������	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�,�+�+�+�+�+�����
�
�
�����	�	�	���:�:�:�:�*������!������
�������g�G�g�N�N������	��
������
������V��(�#�#����F��>�5�*���W�W�W�W��F�����*�&�*�+C�+C�+C�D�D�	�����������������������
�$)�!����4� �����04���59���5�5�5�5�5�t	
���#��� $�� �_�_�_�_�_�D����Z�Z�Z�Z�Z�Z�Z�Z�z,m�m�m�m�m�m�m�m�`s>�s>�s>�s>�s>�s>�s>�s>�l	
�
�
�
�
�h�
�
�
�:Y9�Y9�Y9�Y9�Y9�h�Y9�Y9�Y9�x$�$�$�$�$�w�$�$�$�63�3�3�3�3�.�3�3�3�i?�i?�i?�i?�i?�i?�i?�i?�X{B�{B�{B�{B�{B�5�{B�{B�{B�|/#�/#�/#�/#�/#�,�/#�/#�/#�dd;�d;�d;�d;�d;��d;�d;�d;�N�����"����
nD�nD�nD�nD�nD�E�nD�nD�nD�bH�H�H�H�H��H�H�H�<`�`�`�`�`�e�`�`�`�Fw�w�w�w�w�?�w�w�w�t.�.�.�.�.�0�.�.�.�b,�,�,�,�,�!6�,�,�,�$@F�@F�@F�@F�@F�'�@F�@F�@F�F(�(�(�(�(� 4�(�(�(�X9=������4����
�AF�����
���
�����
���
IN�$�$�$�$�$�N=L�=L�=L�=L�@����:L�L�L�L�^����>'�'�'�'�T����
1�
1�
1�
1���������2 � � � �F����2r&�r&�r&�r&�r&�r&�r&�r&�r&�r&s�>G(�(G,�/G,