
    MhW             
         % S r SSKJr  SSKJr  SSKrSSKJrJr  SSK	r	SSK
r
SSKrSSKJr  SSKJrJrJrJrJrJrJr  SSKrSSKrSSKJrJrJrJr  SS	KJrJ r!  SS
K"J#r#  SSK$J%r%  SSK&J'r'  SSK(J)r)  SSK*J+r+J,r,J-r-J.r.J/r/  SSK0J1r1  SSK2J3r3  SSK4J5r5J6r6J7r7J8r8J9r9J:r:  SSK;J<r<J=r=J>r>J?r?  SSK@JArA  SSKBJCrCJDrDJErEJFrFJGrGJHrHJIrIJJrJJKrKJLrL  SSKMJNrNJOrOJPrP  SSKQJRs  JSrT  SSKUJVrVJWrW  SSKXJYrY  SSKZJ[r[  SSK\J]r]J^r^  SSK_J`r`  SSKaJbrbJcrc  \(       a4  SSKdJereJfrfJgrg  SSKhJiri  SSKjJkrkJlrlJmrm  SSKnJoroJprpJqrqJrrrJsrsJtrtJuruJvrv  SS K\Jwrw  S!rxS"ryS# rzSyS$ jr{S% r|\Vr}SzS& jr~S'rS(\S)'   S*rS(\S+'   S,rS(\S-'   S.S.S/S/S0.r\CS/0rS1rS(\S2'   S3rS(\S4'   \GR                  " S55         \GR                  " S6S7\\GR                  S89  \GR                  " S9S\\GR                  " / S:Q5      S89  SSS5        SqS7qS; r            S{                             S|S< jjr         S}                 S~S= jjrSS> jr " S? S@5      r " SA SB5      r " SC SD5      r " SE SF\5      r " SG SH\5      r " SI SJ\5      r " SK SL\5      r " SM SN5      r " SO SP\5      r " SQ SR\5      r " SS ST\5      r " SU SV\5      r " SW SX\5      r " SY SZ\5      r " S[ S\\5      r " S] S^\5      r " S_ S`\5      r " Sa Sb\5      r " Sc Sd\5      r " Se Sf\5      r S       SSg jjrSSh jr\ S       SSi jj5       r\SSSj jj5       r S       SSk jjrSSl jrSSm jr      SSn jrSSo jr        SSp jrSSq jrSSr jrSSs jrSSt jrSSu jrSSv jr " Sw Sx5      rg! , (       d  f       GN= f)zY
High level interface to PyTables for reading and writing pandas data structures
to disk
    )annotations)suppressN)datetzinfo)dedent)TYPE_CHECKINGAnyCallableFinalLiteralcastoverload)config
get_optionusing_copy_on_writeusing_pyarrow_string_dtype)libwriters)is_string_array)	timezones)import_optional_dependency)patch_pickle)AttributeConflictWarningClosedFileErrorIncompatibilityWarningPerformanceWarningPossibleDataLossError)cache_readonly)find_stack_level)ensure_objectis_bool_dtypeis_complex_dtypeis_list_likeis_string_dtypeneeds_i8_conversion)CategoricalDtypeDatetimeTZDtypeExtensionDtypePeriodDtype)array_equivalent)
	DataFrameDatetimeIndexIndex
MultiIndexPeriodIndex
RangeIndexSeriesTimedeltaIndexconcatisna)CategoricalDatetimeArrayPeriodArray)PyTablesExprmaybe_expression)extract_array)ensure_index)ArrayManagerBlockManager)stringify_path)adjoinpprint_thing)HashableIteratorSequence)TracebackType)ColFileNode)AnyArrayLike	ArrayLikeAxisIntDtypeArgFilePathSelfShapenpt)Blockz0.15.2UTF-8c                f    [        U [        R                  5      (       a  U R                  S5      n U $ )z(if we have bytes, decode them to unicoderQ   )
isinstancenpbytes_decode)ss    D/var/www/html/env/lib/python3.13/site-packages/pandas/io/pytables.py_ensure_decodedrY      s&    !RYYHHWH    c                    U c  [         n U $ N)_default_encodingencodings    rX   _ensure_encodingr`      s    $OrZ   c                F    [        U [        5      (       a  [        U 5      n U $ )z
Ensure that an index / column name is a str (python 3); otherwise they
may be np.string dtype. Non-string dtypes are passed through unchanged.

https://github.com/pandas-dev/pandas/issues/13492
)rS   strnames    rX   _ensure_strre      s     $4yKrZ   c                   US-   n[        U [        [        45      (       a4  U  Vs/ s H&  nUc  M  [        U5      (       a  [	        X2S-   S9OUPM(     n nO[        U 5      (       a	  [	        XS9n U b  [        U 5      (       a  U $ S$ s  snf )z
Ensure that the where is a Term or a list of Term.

This makes sure that we are capturing the scope of variables that are
passed create the terms here with a frame_level=2 (we are 2 levels down)
   Nscope_level)rS   listtupler9   Termlen)whereri   levelterms       rX   _ensure_termrq      s     !OE%$'' 
 R1A$1G1GD19-TQ 	 

 
%	 	 U.MSZZ59T9
s
   B"B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)fru   trv   z;
: boolean
    drop ALL nan rows when appending to a table

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

format_doczio.hdfdropna_tableF)	validatordefault_format)ru   rv   Nc                     [         c=  SS Kn U q [        [        5         U R                  R
                  S:H  qS S S 5        [         $ [         $ ! , (       d  f       [         $ = f)Nr   strict)
_table_modtablesr   AttributeErrorfile_FILE_OPEN_POLICY!_table_file_open_policy_is_strict)r   s    rX   _tablesr      sV     

 n%--9 . &
 : &%
 s   A
Ac           
       ^^^^^	^
^^^^ U(       a  UUUUUUUU	U
U4
S jnOUUUUUUUU	U
U4
S jn[        U 5      n [        U [        5      (       a  [        XXES9 nU" U5        SSS5        gU" U 5        g! , (       d  f       g= f)z+store this object, close it if we opened itc                4   >
 U R                  TT
TTTT	TTTTS9
$ )N)formatindexmin_itemsizenan_repdropnadata_columnserrorsr_   )appendstorer   r   r_   r   r   r   keyr   r   values    rX   <lambda>to_hdf.<locals>.<lambda>  s1    %,,%% ' 
rZ   c                4   >
 U R                  TT
TTTT	TTTTS9
$ )N)r   r   r   r   r   r   r_   r   putr   s    rX   r   r   %  s1    %))%% $ 
rZ   )mode	complevelcomplibN)r>   rS   rb   HDFStore)path_or_bufr   r   r   r   r   r   r   r   r   r   r   r   r   r_   rw   r   s    ``    ````````  rX   to_hdfr     so    $ 
 

 
 !-K+s##i
eH
 

 	
+
 
s   	A66
Bc
                   US;  a  [        SU S35      eUb
  [        USS9n[        U [        5      (       a!  U R                  (       d  [        S5      eU nSnOq[        U 5      n [        U [        5      (       d  [        S	5      e [        R                  R                  U 5      nU(       d  [        S
U  S35      e[        U 4X#S.U
D6nSn Ucc  UR                  5       n[        U5      S:X  a  [        S5      eUS   nUSS  H  n[!        UU5      (       a  M  [        S5      e   UR"                  nUR%                  UUUUUUU	US9$ ! [        [         4 a    Sn Nf = f! [         [        [&        4 aQ    [        U [        5      (       d:  [)        [*        5         UR-                  5         SSS5        e ! , (       d  f       e = fe f = f)aJ  
Read from the store, close it if we opened it.

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

.. warning::

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

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

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

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

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

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

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

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

Examples
--------
>>> df = pd.DataFrame([[1, 1.0, 'a']], columns=['x', 'y', 'z'])  # doctest: +SKIP
>>> df.to_hdf('./store.h5', 'data')  # doctest: +SKIP
>>> reread = pd.read_hdf('./store.h5')  # doctest: +SKIP
)rr+azmode zG is not allowed while performing a read. Allowed modes are r, r+ and a.Nrg   rh   z&The HDFStore must be open for reading.Fz5Support for generic buffers has not been implemented.zFile z does not exist)r   r   Tr   z]Dataset(s) incompatible with Pandas data types, not table, or no datasets found in HDF5 file.z?key must be provided when HDF5 file contains multiple datasets.)rn   startstopcolumnsiterator	chunksize
auto_close)
ValueErrorrq   rS   r   is_openOSErrorr>   rb   NotImplementedErrorospathexists	TypeErrorFileNotFoundErrorgroupsrm   _is_metadata_of_v_pathnameselectLookupErrorr   r   close)r   r   r   r   rn   r   r   r   r   r   kwargsr   r   r   r   candidate_only_groupgroup_to_checks                    rX   read_hdfr   <  s   ^ ##D6 - .
 	

 U2+x((""BCC
$[1+s++%G 	WW^^K0F #eK=$HIII4I&I 
%;\\^F6{a D  $*!9  #)*&~7KLL$;  #- '22C||!  	
 		
A :& 	F	T 	;/ +x00.) * 	 *) 	s=   E A	E .E EE9GF2)	G2
G 	<	Gc                    U R                   UR                   ::  a  gU nUR                   S:  a@  UR                  nX1:X  a  UR                  S:X  a  gUR                  nUR                   S:  a  M@  g)zDCheck if a given group is a metadata group for a given parent_group.Frg   metaT)_v_depth	_v_parent_v_name)groupparent_groupcurrentparents       rX   r   r     si    ~~...G


Q
""!goo&?##	 

Q

 rZ   c                     \ rS rSr% SrS\S'   S\S'       S4       S5S jjrS6S	 jr\S
 5       r	\S6S j5       r
S7S jrS8S jrS8S jrS9S jrS:S jrS;S jrS6S jrS<S jr        S=S jrS>S?S jjrS@S jrSAS jrSBSCS jjrSDS jr\SES j5       rSFSGS jjrS7S jr       SH       SIS jjr   SJ     SKS jjr  SL       SMS jjr        SN     SOS  jjr            SP                     SQS! jjr SJS8S" jjr!               SR                     SSS# jjr"   ST     SUS$ jjr#   SJ       SVS% jjr$SWS& jr%SXSYS' jjr&SZS( jr'S[S) jr(       S\           S]S* jjr)S6S+ jr*SDS, jr+S^S- jr,    S_       S`S. jjr-               Sa                     SbS/ jjr.ScS0 jr/SdS1 jr0SeS2 jr1S3r2g)fr   i  a  
Dict-like IO interface for storing pandas objects in PyTables.

Either Fixed or Table format.

.. warning::

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

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

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

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

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

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

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

>>> bar = pd.DataFrame(np.random.randn(10, 4))
>>> store = pd.HDFStore('test.h5', driver='H5FD_CORE')
>>> store['foo'] = bar
>>> store.close()   # only now, data is written to disk
zFile | None_handlerb   _modeNc                   SU;   a  [        S5      e[        S5      nUb<  XGR                  R                  ;  a#  [        SUR                  R                   S35      eUc  Ub  UR                  R                  n[        U5      U l        Uc  SnX l        S U l        U(       a  UOSU l	        X@l
        XPl        S U l        U R                  " S	SU0UD6  g )
Nr   z-format is not a defined argument for HDFStorer   zcomplib only supports z compression.r   r   r    )r   r   filtersall_complibsdefault_complibr>   _pathr   r   
_complevel_complib_fletcher32_filtersopen)selfr   r   r   r   
fletcher32r   r   s           rX   __init__HDFStore.__init__*  s     vLMM+H57..2M2M#M()D)D(E]S  ?y4nn44G#D)
<D
'0)a%		&t&v&rZ   c                    U R                   $ r\   r   r   s    rX   
__fspath__HDFStore.__fspath__K  s    zzrZ   c                l    U R                  5         U R                  c   eU R                  R                  $ )zreturn the root node)_check_if_openr   rootr   s    rX   r   HDFStore.rootN  s0     	||'''||   rZ   c                    U R                   $ r\   r   r   s    rX   filenameHDFStore.filenameU      zzrZ   c                $    U R                  U5      $ r\   )getr   r   s     rX   __getitem__HDFStore.__getitem__Y  s    xx}rZ   c                &    U R                  X5        g r\   r   )r   r   r   s      rX   __setitem__HDFStore.__setitem__\  s    rZ   c                $    U R                  U5      $ r\   )remover   s     rX   __delitem__HDFStore.__delitem___  s    {{3rZ   c                     U R                  U5      $ ! [        [        4 a     Of = f[        S[	        U 5      R
                   SU S35      e)z$allow attribute access to get stores'z' object has no attribute ')r   KeyErrorr   r   type__name__)r   rd   s     rX   __getattr__HDFStore.__getattr__b  sW    	88D>!/* 		T
##$$?vQG
 	
s    &&c                Z    U R                  U5      nUb  UR                  nXUSS 4;   a  gg)z`
check for existence of this key
can match the exact pathname or the pathnm w/o the leading '/'
Nrg   TF)get_noder   )r   r   noderd   s       rX   __contains__HDFStore.__contains__l  s:    
 }}S!##DT!"X&&rZ   c                4    [        U R                  5       5      $ r\   )rm   r   r   s    rX   __len__HDFStore.__len__x  s    4;;=!!rZ   c                N    [        U R                  5      n[        U 5       SU S3$ )N
File path: 
)r@   r   r   )r   pstrs     rX   __repr__HDFStore.__repr__{  s'    DJJ't*]4&33rZ   c                    U $ r\   r   r   s    rX   	__enter__HDFStore.__enter__  s    rZ   c                $    U R                  5         g r\   )r   )r   exc_type	exc_value	tracebacks       rX   __exit__HDFStore.__exit__  s     	

rZ   c                &   US:X  a*  U R                  5        Vs/ s H  o"R                  PM     sn$ US:X  aC  U R                  c   eU R                  R                  SSS9 Vs/ s H  o"R                  PM     sn$ [	        SU S35      es  snf s  snf )a  
Return a list of keys corresponding to objects stored in HDFStore.

Parameters
----------

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

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

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

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> store = pd.HDFStore("store.h5", 'w')  # doctest: +SKIP
>>> store.put('data', df)  # doctest: +SKIP
>>> store.get('data')  # doctest: +SKIP
>>> print(store.keys())  # doctest: +SKIP
['/data1', '/data2']
>>> store.close()  # doctest: +SKIP
pandasnative/Table)	classnamez8`include` should be either 'pandas' or 'native' but is 'r   )r   r   r   
walk_nodesr   )r   includens      rX   keysHDFStore.keys  s    < h+/;;=9=aMM=99 <<+++'+||'>'>sg'>'V'V!'V  FwiqQ
 	
 :s   B	"Bc                4    [        U R                  5       5      $ r\   )iterr  r   s    rX   __iter__HDFStore.__iter__  s    DIIK  rZ   c              #  Z   #    U R                  5        H  nUR                  U4v   M     g7f)z
iterate on key->group
N)r   r   r   gs     rX   itemsHDFStore.items  s&      A--"" s   )+c                   [        5       nU R                  U:w  aZ  U R                  S;   a  US;   a  O=US;   a7  U R                  (       a&  [        SU R                   SU R                   S35      eXl        U R                  (       a  U R                  5         U R                  (       aL  U R                  S:  a<  [        5       R                  U R                  U R                  U R                  S9U l
        [        (       a  U R                  (       a  S	n[        U5      eUR                  " U R                  U R                  40 UD6U l        g
)z
Open the file in the specified mode

Parameters
----------
mode : {'a', 'w', 'r', 'r+'}, default 'a'
    See HDFStore docstring or tables.open_file for info about modes
**kwargs
    These parameters will be passed to the PyTables open_file method.
)r   w)r   r   )r$  zRe-opening the file [z] with mode [z] will delete the current file!r   )r   zGCannot open HDF5 file, which is already opened, even in read-only mode.N)r   r   r   r   r   r   r   Filtersr   r   r   r   r   	open_filer   )r   r   r   r   msgs        rX   r   HDFStore.open  s    ::zzZ'DK,?<<//

|= U8 8 
 J <<JJL??t2#I--4;K;K . DM -,*  S/!''

DJJI&IrZ   c                `    U R                   b  U R                   R                  5         SU l         g)z 
Close the PyTables file handle
N)r   r   r   s    rX   r   HDFStore.close  s%     <<#LL rZ   c                \    U R                   c  g[        U R                   R                  5      $ )z6
return a boolean indicating whether the file is open
F)r   boolisopenr   s    rX   r   HDFStore.is_open  s&    
 <<DLL''((rZ   c                   U R                   bi  U R                   R                  5         U(       aG  [        [        5         [        R
                  " U R                   R                  5       5        SSS5        ggg! , (       d  f       g= f)a  
Force all buffered modifications to be written to disk.

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

Notes
-----
Without ``fsync=True``, flushing may not guarantee that the OS writes
to disk. With fsync, the operation will block until the OS claims the
file has been written; however, other caching layers may still
interfere.
N)r   flushr   r   r   fsyncfileno)r   r1  s     rX   r0  HDFStore.flush  s]      <<#LL g&HHT\\0023 '&  $ '&s   /A88
Bc                    [        5          U R                  U5      nUc  [        SU S35      eU R                  U5      sSSS5        $ ! , (       d  f       g= f)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)r   r   r   _read_groupr   r   r   s      rX   r   HDFStore.get  sK    * ^ MM#&E}!1#lCDD##E* ^^s   4A		
Ac	                  ^^ U R                  U5      n	U	c  [        SU S35      e[        USS9nU R                  U	5      mTR	                  5         UU4S jn
[        U TU
UTR                  UUUUUS9
nUR                  5       $ )a  
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
r5  r6  rg   rh   c                &   > TR                  XUTS9$ )N)r   r   rn   r   )read)_start_stop_wherer   rW   s      rX   funcHDFStore.select.<locals>.funcy  s    66&'6RRrZ   rn   nrowsr   r   r   r   r   )r   r   rq   _create_storer
infer_axesTableIteratorrC  
get_result)r   r   rn   r   r   r   r   r   r   r   r@  itrW   s        `      @rX   r   HDFStore.select/  s    @ c"=-cU,?@@ U2&		S ''!
 }}rZ   c                    [        USS9nU R                  U5      n[        U[        5      (       d  [	        S5      eUR                  X#US9$ )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
rg   rh   z&can only read_coordinates with a tablern   r   r   )rq   
get_storerrS   r  r   read_coordinates)r   r   rn   r   r   tbls         rX   select_as_coordinatesHDFStore.select_as_coordinates  sM    4 U2ooc"#u%%DEE##%4#HHrZ   c                    U R                  U5      n[        U[        5      (       d  [        S5      eUR	                  X#US9$ )a  
return a single column from the table. This is generally only useful to
select an indexable

.. warning::

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

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

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

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

z!can only read_column with a table)columnr   r   )rL  rS   r  r   read_column)r   r   rR  r   r   rN  s         rX   select_columnHDFStore.select_column  s?    F ooc"#u%%?@@fEErZ   c
                  ^^^ [        USS9n[        U[        [        45      (       a  [	        U5      S:X  a  US   n[        U[
        5      (       a  U R                  UUTUUUUU	S9$ [        U[        [        45      (       d  [        S5      e[	        U5      (       d  [        S5      eUc  US   nU V
s/ s H  oR                  U
5      PM     sn
mU R                  U5      nSn[        R                  " X4/[        TU5      5       Hm  u  pUc  [        SU
 S	35      eUR                  (       d  [        S
UR                   S35      eUc  UR                   nMR  UR                   U:w  d  Md  [        S5      e   T Vs/ s H  n[        U["        5      (       d  M  UPM     nnU Vs1 s H  oR$                  S   S   iM     snR'                  5       mUUU4S jn[)        U UUUUUUUUU	S9
nUR+                  SS9$ s  sn
f s  snf s  snf )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
rg   rh   r   )r   rn   r   r   r   r   r   r   zkeys must be a list/tuplez keys must have a non-zero lengthNzInvalid table []zobject [z>] is not a table, and cannot be used in all select as multiplez,all tables must have exactly the same nrows!c           
        > T Vs/ s H  nUR                  UTXS9PM     nn[        UTSS9R                  5       $ s  snf )Nrn   r   r   r   F)axisverify_integrity)r<  r3   _consolidate)r=  r>  r?  rx   objsrZ  r   tblss        rX   r@  )HDFStore.select_as_multiple.<locals>.func2  sS    
 A VWFO   $TEBOOQQs   <rB  T)coordinates)rq   rS   rj   rk   rm   rb   r   r   r   rL  	itertoolschainzipr   is_tablepathnamerC  r  non_index_axespoprF  rG  )r   r  rn   selectorr   r   r   r   r   r   krW   rC  rx   x_tblsr@  rH  rZ  r^  s       `             @@rX   select_as_multipleHDFStore.select_as_multiple  s   V U2dT5M**s4yA~7DdC  ;;!#%  	 	 $u..7884yy?@@AwH -11Dq"D1OOH% OOa]OSt_EDAy1566::qzzl +) ) 
 }E! !OPP F  !9DqJq%$8D9 1661  #A&6::<		R !
 }}}..g 2* : 7s   5G;=H H &Hc                    Uc  [        S5      =(       d    SnU R                  U5      nU R                  UUUUUUUUU	U
UUUUS9  g)a  
Store object in HDFStore.

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

    ``'fixed'``
        Fixed format.  Fast writing/reading. Not-appendable, nor searchable.
    ``'table'``
        Table format.  Write as a PyTables Table structure which may perform
        worse but allow more flexible operations like searching / selecting
        subsets of the data.
index : bool, default True
    Write DataFrame index as a column.
append : bool, default False
    This will force Table format, append the input data to the existing.
data_columns : list of columns or True, default None
    List of columns to create as data columns, or True to use all columns.
    See `here
    <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#query-via-data-columns>`__.
encoding : str, default None
    Provide an encoding for strings.
track_times : bool, default True
    Parameter is propagated to 'create_table' method of 'PyTables'.
    If set to False it enables to have the same h5 files (same hashes)
    independent on creation time.
dropna : bool, default False, optional
    Remove missing values.

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> store = pd.HDFStore("store.h5", 'w')  # doctest: +SKIP
>>> store.put('data', df)  # doctest: +SKIP
Nio.hdf.default_formatru   )r   r   r   r   r   r   r   r   r_   r   track_timesr   )r   _validate_format_write_to_group)r   r   r   r   r   r   r   r   r   r   r   r_   r   rp  r   s                  rX   r   HDFStore.putM  sg    p > 78CGF&&v.%%# 	 	
rZ   c                   [        USS9n U R                  U5      n[        R                  " X#U5      (       a  WR                  R                  SS9  gWR                  (       d  [        S5      eUR                  X#US9$ ! [         a    e [         a    e [         aA  nUb  [        S5      UeU R                  U5      nUb  UR                  SS9   SnAg SnANSnAff = f)	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

rg   rh   Nz5trying to remove a node with a non-None where clause!T	recursivez7can only remove with where on objects written as tablesrK  )rq   rL  r   AssertionError	Exceptionr   r   	_f_removecomall_noner   rd  delete)r   r   rn   r   r   rW   errr   s           rX   r   HDFStore.remove  s    * U2	$A. <<d++GG- :: M  88%48@@?  	 	 	   K
 ==%D.  	s   A? ?C2CCc                    U	b  [        S5      eUc  [        S5      nUc  [        S5      =(       d    SnU R                  U5      nU R                  UUUUUUUUU
UUUUUUUS9  g)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_columnszio.hdf.dropna_tablero  rv   )r   axesr   r   r   r   r   r   r   expectedrowsr   r   r_   r   )r   r   rq  rr  )r   r   r   r   r  r   r   r   r   r   r   r   r   r  r   r   r_   r   s                     rX   r   HDFStore.append  s    R P  > 56F> 78CGF&&v.%%%! 	 	
rZ   c                2  ^ Ub  [        S5      e[        U[        5      (       d  [        S5      eX1;  a  [        S5      e[	        [        [        [        TR                  5      5      [        [        [        T5         5      -
  5      5      nSn	/ n
UR                  5        H+  u  pUc  U	b  [        S5      eUn	M  U
R                  U5        M-     U	bV  TR                  U   nUR                  [        U
5      5      n[!        UR#                  U5      5      nUR%                  U5      X'   Uc  X   nU(       aN  U4S jUR'                  5        5       n[	        U5      nU H  nUR)                  U5      nM     TR*                  U   mUR-                  SS5      nUR                  5        Hh  u  pX:X  a  UOSnTR/                  XS9nUb/  UR                  5        VVs0 s H  u  nnUU;   d  M  UU_M     snnOSnU R0                  " UU4UUS	.UD6  Mj     gs  snnf )
a  
Append to multiple tables

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

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

Nztaxes is currently not accepted as a parameter to append_to_multiple; you can create the tables independently insteadzQappend_to_multiple must have a dictionary specified as the way to split the valuez=append_to_multiple requires a selector that is in passed dictz<append_to_multiple can only have one value in d that is Nonec              3  \   >#    U  H!  nTU   R                  S S9R                  v   M#     g7f)all)howN)r   r   ).0colsr   s     rX   	<genexpr>.HDFStore.append_to_multiple.<locals>.<genexpr>  s)     OJDE$K&&5&177Js   ),r   rZ  )r   r   )r   rS   dictr   nextr  setrangendim	_AXES_MAPr   r!  extendr  
differencer-   sortedget_indexertakevaluesintersectionlocrg  reindexr   )r   dr   rh  r   r  r   r   rZ  
remain_keyremain_valuesri  vorderedorddidxsvalid_indexr   r   dcvalr   filtereds     `                    rX   append_to_multipleHDFStore.append_to_multiple8  s   > B 
 !T"") 
 O 
 DU5::./#iU6L2MMNO 
 GGIDAy)$V  
$$Q'  !jj&G%%eM&:;D'--d34D#LL.AM ;L OAHHJODt*K)66u= IIk*Ezz.$7 GGIDA!"DB ----C  + 1=0B0B0DQ0Deqe0DQ 
 KK3QRhQ&Q  Rs   H*Hc                    [        5         U R                  U5      nUc  g[        U[        5      (       d  [	        S5      eUR                  X#US9  g)aP  
Create a pytables index on the table.

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

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

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

Raises
------
TypeError: raises if the node is not a table
Nz1cannot create table index on a Fixed format store)r   optlevelkind)r   rL  rS   r  r   create_index)r   r   r   r  r  rW   s         rX   create_table_indexHDFStore.create_table_index  sH    > 		OOC 9!U##OPP	wErZ   c                   [        5         U R                  5         U R                  c   e[        c   eU R                  R	                  5        Vs/ s H  n[        U[        R                  R                  5      (       a  M.  [        UR                  SS5      (       dO  [        USS5      (       d=  [        U[        R                  R                  5      (       d  M  UR                  S:w  d  M  UPM     sn$ s  snf )a  
Return a list of all the top-level nodes.

Each node returned is not a pandas storage object.

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

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> store = pd.HDFStore("store.h5", 'w')  # doctest: +SKIP
>>> store.put('data', df)  # doctest: +SKIP
>>> print(store.groups())  # doctest: +SKIP
>>> store.close()  # doctest: +SKIP
[/data (Group) ''
  children := ['axis0' (Array), 'axis1' (Array), 'block0_values' (Array),
  'block0_items' (Array)]]
Npandas_typerv   )r   r   r   r   walk_groupsrS   linkLinkgetattr_v_attrsrv   r  r   r  s     rX   r   HDFStore.groups  s    , 		||'''%%% \\--/
/q*//"6"67 
 AJJt<<q'400"1j&6&6&<&<=  CD))wBV /
 	
 
s   -C4 AC4C4+C4c              #  j  #    [        5         U R                  5         U R                  c   e[        c   eU R                  R	                  U5       H  n[        UR                  SS5      b  M  / n/ nUR                  R                  5        H  n[        UR                  SS5      nUcH  [        U[        R                  R                  5      (       a  UR                  UR                  5        Mc  Me  UR                  UR                  5        M     UR                  R                  S5      X44v   M     g7f)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  rS   r   Groupr   r   r   rstrip)r   rn   r   r   leaveschildr  s          rX   walkHDFStore.walk  s     N 		||'''%%%))%0Aqzz=$7CFF--/%ennmTJ&!%)9)9)?)?@@emm4 A MM%--0 0 =='',f== 1s   D1D3c                   U R                  5         UR                  S5      (       d  SU-   nU R                  c   e[        c   e U R                  R	                  U R
                  U5      n[        U[        R                  5      (       d   [        U5      5       eU$ ! [        R                  R                   a     gf = f)z9return the node with the key or None if it does not existr  N)r   
startswithr   r   r   r   
exceptionsNoSuchNodeErrorrS   rG   r   )r   r   r   s      rX   r   HDFStore.get_node$  s    ~~c"")C||'''%%%	<<((C8D $
00<$t*<0	 $$44 		s   &B B=<B=c                    U R                  U5      nUc  [        SU S35      eU R                  U5      nUR                  5         U$ )z<return the storer object for a key, raise if not in the filer5  r6  )r   r   rD  rE  )r   r   r   rW   s       rX   rL  HDFStore.get_storer4  sH    c"=-cU,?@@&	rZ   c	                h   [        XXVUS9n	Uc  [        U R                  5       5      n[        U[        [        45      (       d  U/nU H  n
U R                  U
5      nUc  M  X;   a  U(       a  U	R                  U
5        U R                  U
5      n[        U[        5      (       ak  SnU(       a8  UR                   Vs/ s H!  oR                  (       d  M  UR                  PM#     nnU	R                  U
UU[        USS5      UR                  S9  M  U	R                  XUR                  S9  M     U	$ s  snf )a  
Copy the existing store to a new file, updating in place.

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

Returns
-------
open file handle of the new store
)r   r   r   r   NFr   )r   r   r_   r^   )r   rj   r  rS   rk   rL  r   r   r  r  
is_indexedrd   r   r  r_   r   )r   r   r   propindexesr  r   r   r   	overwrite	new_storeri  rW   datar   r   s                  rX   copyHDFStore.copy>  s   8 Wj
	 <		$D$..6DA"A}> !((+{{1~a''.3E"12 HA<< H$$#%,Q%E!" %  MM!AJJM?) ,  !Is   ;D/D/c                   [        U R                  5      n[        U 5       SU S3nU R                  (       a  [	        U R                  5       5      n[        U5      (       a  / n/ nU Hj  n U R                  U5      nUbR  UR                  [        UR                  =(       d    U5      5        UR                  [        U=(       d    S5      5        Mj  Ml     U[        SXE5      -  nU$ US-  n U$ US	-  nU$ ! [         a    e [         a<  nUR                  U5        [        U5      n	UR                  SU	 S35         SnAM  SnAff = f)
a  
Print detailed information on the store.

Returns
-------
str

Examples
--------
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
>>> store = pd.HDFStore("store.h5", 'w')  # doctest: +SKIP
>>> store.put('data', df)  # doctest: +SKIP
>>> print(store.info())  # doctest: +SKIP
>>> store.close()  # doctest: +SKIP
<class 'pandas.io.pytables.HDFStore'>
File path: store.h5
/data    frame    (shape->[2,2])
r  r  Nzinvalid_HDFStore nodez[invalid_HDFStore node: rW     EmptyzFile is CLOSED)r@   r   r   r   r  r  rm   rL  r   re  rw  rx  r?   )
r   r   outputlkeysr  r  ri  rW   detaildstrs
             rX   infoHDFStore.infoy  s6   & DJJ'J<}TF"5<<499;'E5zzAJ OOA.= KKQZZ_1(EF"MM,q7S<S*TU )  &T22 	 '!  &&F * $ JA+F3(@a&HIIJs   +A$C55E	1E  Ec                V    U R                   (       d  [        U R                   S35      eg )Nz file is not open!)r   r   r   r   s    rX   r   HDFStore._check_if_open  s%    ||!TZZL0B"CDD rZ   c                z     [         UR                  5          nU$ ! [         a  n[        SU S35      UeSnAff = f)zvalidate / deprecate formatsz#invalid HDFStore format specified [rW  N)_FORMAT_MAPlowerr   r   )r   r   r}  s      rX   rq  HDFStore._validate_format  sK    	V 0F   	VA&KLRUU	Vs    
:5:c           	     8   Ub&  [        U[        [        45      (       d  [        S5      e[	        [        UR                  SS5      5      n[	        [        UR                  SS5      5      nUc  Uc^  [        5         [        c   e[        USS5      (       d)  [        U[        R                  R                  5      (       a  SnSnO0[        S5      e[        U[        5      (       a  S	nOS
nUS:X  a  US-  nSU;  a  [        [        S.n X   n	U	" XXES9$ Ucz  Ubw  US:X  a6  [        USS5      nUb%  UR                  S:X  a  SnONUR                  S:  a  SnO;US:X  a5  [        USS5      nUb%  UR                  S:X  a  SnOUR                  S:  a  Sn[         ["        [$        [&        [(        [*        S.n X   n	U	" XXES9$ ! [         a#  n
[        SU S[        U5       SU 35      U
eSn
A
ff = f! [         a#  n
[        SU S[        U5       SU 35      U
eSn
A
ff = f)z"return a suitable class to operateNz(value must be None, Series, or DataFramer  
table_typerv   frame_tablegeneric_tablezKcannot create a storer if the object is not existing nor a value are passedseriesframe_table)r  r  z=cannot properly create the storer for: [_STORER_MAP] [group->,value->z	,format->r_   r   series_tabler   rg   appendable_seriesappendable_multiseriesappendable_frameappendable_multiframe)r  r  r  r  r  wormz<cannot properly create the storer for: [_TABLE_MAP] [group->)rS   r1   r+   r   rY   r  r  r   r   rv   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                rX   rD  HDFStore._create_storer  s\    Z	7J%K%KFGGWU^^]DIJWU^^\4HI :}	!---5'400J:++115 5 'B(B#1 
 eV,,!B B W$(NB "%0:FK!o tXEE : '#E7D9E( ==A-!4B"]]Q.!9B=(#E7D9E( ==A-!3B"]]Q.!8B *!6&@ 4%>

	.C 4AAU  SgXd5k])F8E H  	N'$u+ixA 	s0   F< 1G, <
G)G$$G),
H6HHc                Z   [        USS 5      (       a  US:X  d  U(       a  g U R                  X5      nU R                  UX2UUS9nU(       af  UR                  (       a(  UR                  (       a"  US:X  a  UR                  (       a  [        S5      eUR                  (       d  UR                  5         OUR                  5         UR                  (       d  U(       a  [        S5      eUR                  UUUUUU	U
UUUUUUS9  [        U[        5      (       a  U(       a  UR                  US9  g g g )	Nemptyrv   r  ru   zCan only append to Tablesz0Compression not supported on Fixed format stores)objr  r   r   r   r   r   r   r  r   r   r   rp  )r   )r  _identify_grouprD  rd  	is_existsr   set_object_infowriterS   r  r  )r   r   r   r   r  r   r   r   r   r   r   r   r  r   r   r   r_   r   rp  r   rW   s                        rX   rr  HDFStore._write_to_group  s
   . 5'4((f.?6$$S1vxPVW ::!**71Bq{{ !<==;;!!#zzgOPP 	
!%%%# 	 	
  aENN5N) %*rZ   c                d    U R                  U5      nUR                  5         UR                  5       $ r\   )rD  rE  r<  )r   r   rW   s      rX   r7  HDFStore._read_groupU  s&    &	vvxrZ   c                    U R                  U5      nU R                  c   eUb#  U(       d  U R                  R                  USS9  SnUc  U R                  U5      nU$ )z@Identify HDF5 group based on key, delete/create group if needed.NTru  )r   r   remove_node_create_nodes_and_group)r   r   r   r   s       rX   r  HDFStore._identify_groupZ  sb    c" ||''' VLL$$Ud$;E=005ErZ   c                $   U R                   c   eUR                  S5      nSnU Hg  n[        U5      (       d  M  UnUR                  S5      (       d  US-  nXT-  nU R	                  U5      nUc  U R                   R                  X45      nUnMi     W$ )z,Create nodes from key and return group name.r  )r   splitrm   endswithr   create_group)r   r   pathsr   pnew_pathr   s          rX   r   HDFStore._create_nodes_and_groupl  s     ||'''		#Aq66H==%%CMHMM(+E}11$:D  rZ   )r   r   r   r   r   r   r   )r   NNF)r   rb   r   
int | Noner   r,  returnNoner  rb   r   rb   )r   rb   r  r  )rd   rb   )r   rb   r  r,  r  int)r  rM   )r
  ztype[BaseException] | Noner  zBaseException | Noner  zTracebackType | Noner  r  )r  )r  rb   r  	list[str])r  zIterator[str])r  zIterator[tuple[str, list]])r   )r   rb   r  r  r  r  r  r,  F)r1  r,  r  r  )NNNNFNF)r   rb   r   r,  r   r  r   r,  NNNr   rb   r   r  r   r  NN)r   rb   rR  rb   r   r  r   r  )NNNNNFNF)r   r,  r   r  r   r,  )NTFNNNNNNr   TF)r   rb   r   DataFrame | Seriesr   r,  r   r,  r   r  r   int | dict[str, int] | Noner    Literal[True] | list[str] | Noner   rb   rp  r,  r   r,  r  r  )NNTTNNNNNNNNNNr   )r   rb   r   r  r   bool | list[str]r   r,  r   r  r   r  r   r  r   bool | Noner   r   r   rb   r  r  )NNF)r  r  r   r,  r  r  )r   rb   r  r  r  
str | Noner  r  )r  rj   )r  )rn   rb   r  z*Iterator[tuple[str, list[str], list[str]]])r   rb   r  zNode | None)r   rb   r  GenericFixed | Table)r$  TNNNFT)r   rb   r  r,  r   r  r   r,  r  r,  r  r   )r   rb   r  rb   )NNrQ   r   )r   zDataFrame | Series | Noner_   rb   r   rb   r  r$  )NTFNNNNNNFNNNr   T)r   rb   r   r  r   r!  r   r,  r   r  r   r  r   r  r   r,  r   rb   rp  r,  r  r  )r   rG   )r   rb   r   r,  r  rG   )r   rb   r  rG   )3r   
__module____qualname____firstlineno____doc____annotations__r   r   propertyr   r   r   r   r   r   r   r   r  r  r  r  r  r!  r   r   r   r0  r   r   rO  rT  rl  r   r   r   r  r  r   r  r   rL  r  r  r   rq  rD  rr  r7  r  r  __static_attributes__r   rZ   rX   r   r     s?   ?B J
  $ ' ' 	' ' 
'B ! !   

"4, ( (	
 
(
T!#+JZ ) )4,+@  $ [[ [ [ [@  II 	I
 IH !&F&F &F 	&F
 &FV  $ w/ w/ w/ w/z  $489= J
J
 "J

 J
 J
 J
 2J
 7J
 J
 J
 J
  
!J
X7Az "& $48 $"9=%d
d
 "d
  d
 d
 d
 2d
 d
 d
  7!d
$ %d
& 
'd
V _R_R _R 
_RH #&F&F 	&F
 &F 
&FP%
N:>x    $ 9 9 	9 9 9 9 
9v0jE +/YB )	YB
 YB YB 
YB@ "& $48 $ '<*<* "<*  <* <* <* 2<* <* <*$ %<*& '<*( 
)<*|
$rZ   r   c                      \ rS rSr% SrS\S'   S\S'   S\S'        S           SS
 jjrSS jrSS jrSSS jjr	Sr
g	)rF  i  a!  
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$  rW   Nc                *   Xl         X l        X0l        X@l        U R                  R                  (       a  Uc  SnUc  SnUc  Un[        XW5      nXPl        X`l        Xpl        S U l	        U(       d  U	b  U	c  Sn	[        U	5      U l        OS U l        Xl        g )Nr   順 )r   rW   r@  rn   rd  minrC  r   r   r`  r  r   r   )r   r   rW   r@  rn   rC  r   r   r   r   r   s              rX   r   TableIterator.__init__  s     
	
 66??}}|u#D

	y, "	 ^DN!DN$rZ   c              #  l  #    U R                   nU R                  c  [        S5      eXR                  :  am  [	        XR
                  -   U R                  5      nU R                  S S U R                  X 5      nUnUb  [        U5      (       d  Mg  Uv   XR                  :  a  Mm  U R                  5         g 7f)Nz*Cannot iterate until get_result is called.)	r   r`  r   r   r/  r   r@  rm   r   )r   r   r   r   s       rX   r  TableIterator.__iter__  s     **#IJJ		!w/;DIIdD$*:*:7*HIEG}CJJK 		! 	

s   BB4#B4c                \    U R                   (       a  U R                  R                  5         g g r\   )r   r   r   r   s    rX   r   TableIterator.close  s    ??JJ rZ   c                $   U R                   bT  [        U R                  [        5      (       d  [	        S5      eU R                  R                  U R                  S9U l        U $ U(       ad  [        U R                  [        5      (       d  [	        S5      eU R                  R                  U R                  U R                  U R                  S9nOU R                  nU R                  U R                  U R                  U5      nU R                  5         U$ )Nz0can only use an iterator or chunksize on a table)rn   z$can only read_coordinates on a tablerK  )r   rS   rW   r  r   rM  rn   r`  r   r   r@  r   )r   r`  rn   resultss       rX   rG  TableIterator.get_result  s    >>%dffe,, RSS#vv66TZZ6HDK dffe,, FGGFF++jj

 , E JJE ))DJJ		59

rZ   )
r   r   r`  r@  rC  rW   r   r   r   rn   )NNFNF)r   r   rW   r$  r   r,  r   r  r   r,  r  r  r  rB   r  r  )r`  r,  )r   r%  r&  r'  r(  r)  r   r  r   rG  r+  r   rZ   rX   rF  rF    s    & O  $ (%(%  (% (% (% (% 
(%T  rZ   rF  c                     \ rS rSr% SrSrS\S'   SrS\S'   / SQr             S#     S$S	 jjr	\
S%S
 j5       r\
S&S j5       rS'S jrS&S jrS(S jrS)S jr\
S)S j5       r        S*S jrS r\
S 5       r\
S 5       r\
S 5       r\
S 5       rS+S jrS,S-S jjrS-S jrS.S jrS,S jrS/S jrS-S jrS-S jrS-S jr S0S  jr!S0S! jr"S"r#g)1IndexColi  z
an index column description class

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

Tr,  is_an_indexableis_data_indexable)freqtz
index_nameNc                   [        U[        5      (       d  [        S5      eX l        X0l        X@l        Xl        U=(       d    UU l        X`l        Xpl	        Xl
        Xl        Xl        Xl        Xl        Xl        Xl        Ub  U R#                  U5        [        U R                  [        5      (       d   e[        U R                  [        5      (       d   eg )Nz`name` must be a str.)rS   rb   r   r  r  typrd   cnamerZ  posr=  r>  r?  r  rv   r   metadataset_pos)r   rd   r  r  rA  rB  rZ  rC  r=  r>  r?  r  rv   r   rD  s                  rX   r   IndexCol.__init__  s    " $$$455		]d
		$
	 ?LL $))S))))$**c****rZ   c                .    U R                   R                  $ r\   )rA  itemsizer   s    rX   rH  IndexCol.itemsize/  s     xx   rZ   c                     U R                    S3$ )N_kindrc   r   s    rX   	kind_attrIndexCol.kind_attr4      ))E""rZ   c                T    Xl         Ub  U R                  b  XR                  l        ggg)z,set the position of this column in the TableN)rC  rA  _v_pos)r   rC  s     rX   rE  IndexCol.set_pos8  s%    ?txx3!HHO  4?rZ   c           
        [        [        [        U R                  U R                  U R
                  U R                  U R                  45      5      nSR                  [        / SQU5       VVs/ s H  u  p#U SU 3PM     snn5      $ s  snnf )N,)rd   rB  rZ  rC  r  ->)
rk   mapr@   rd   rB  rZ  rC  r  joinrc  r   tempr   r   s       rX   r  IndexCol.__repr__>  s    tyy$**dii499UV
 xx #&&NPT"U"UJC %r%!"U
 	
   -B
c                2   ^ ^ [        UU 4S jS 5       5      $ )compare 2 col itemsc              3  Z   >#    U  H   n[        TUS 5      [        TUS 5      :H  v   M"     g 7fr\   r  r  r   otherr   s     rX   r  "IndexCol.__eq__.<locals>.<genexpr>K  s/      
5 D!T"geQ&==5   (+)rd   rB  rZ  rC  r  r   r`  s   ``rX   __eq__IndexCol.__eq__I  s     
5
 
 	
rZ   c                .    U R                  U5      (       + $ r\   )re  rd  s     rX   __ne__IndexCol.__ne__P  s    ;;u%%%rZ   c                    [        U R                  S5      (       d  g[        U R                  R                  U R                  5      R
                  $ )z%return whether I am an indexed columnr  F)hasattrrv   r  r  rB  r  r   s    rX   r  IndexCol.is_indexedS  s7     tzz6**tzz

3>>>rZ   c                   [        U[        R                  5      (       d   [        U5      5       eUR                  R
                  b  XR                     R                  5       n[        U R                  5      n[        XX45      n0 n[        U R                  5      US'   U R                  b  [        U R                  5      US'   [        n[        R                  " UR                  S5      (       d  [        UR                  [         5      (       a  ["        nOUR                  S:X  a	  SU;   a  S n U" U40 UD6n['        XR(                  5      n	X4$ ! [$         a    SU;   a  SUS'   U" U40 UD6n N8f = f)zF
Convert the data from this selection to the appropriate pandas type.
Nrd   r=  Mi8c                n    [         R                  " XR                  SS 5      S9R                  US   5      $ )Nr=  )r=  rd   )r/   from_ordinalsr   _rename)rj  kwdss     rX   r   "IndexCol.convert.<locals>.<lambda>{  s3    (A(A.)gV)rZ   )rS   rT   ndarrayr   dtypefieldsrB  r  rY   r  _maybe_convertr?  r=  r-   r   is_np_dtyper'   r,   r   _set_tzr>  )
r   r  r   r_   r   val_kindr   factorynew_pd_indexfinal_pd_indexs
             rX   convertIndexCol.convert[  sJ    &"**--;tF|;- <<* JJ',,.F"499-(C(9v99 ,TYY7F6N/4??6<<--LL/2
 2
 $G\\T!f&6
G	5"64V4L !ww7--  	5 !%v"64V4L	5s   /	E E10E1c                    U R                   $ )zreturn the valuesr  r   s    rX   	take_dataIndexCol.take_data  s    {{rZ   c                .    U R                   R                  $ r\   )rv   r  r   s    rX   attrsIndexCol.attrs      zz"""rZ   c                .    U R                   R                  $ r\   rv   descriptionr   s    rX   r  IndexCol.description      zz%%%rZ   c                D    [        U R                  U R                  S5      $ )z!return my current col descriptionN)r  r  rB  r   s    rX   colIndexCol.col  s     t''T::rZ   c                    U R                   $ zreturn my cython valuesr  r   s    rX   cvaluesIndexCol.cvalues  s     {{rZ   c                ,    [        U R                  5      $ r\   )r  r  r   s    rX   r  IndexCol.__iter__  s    DKK  rZ   c                "   [        U R                  5      S:X  av  [        U[        5      (       a  UR	                  U R
                  5      nUbB  U R                  R                  U:  a'  [        5       R                  XR                  S9U l        gggg)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)rH  rC  )rY   r  rS   r  r   rd   rA  rH  r   	StringColrC  )r   r   s     rX   maybe_set_sizeIndexCol.maybe_set_size  sv     499%1,--+//		:'DHH,=,=,L"9..((.S -M'	 2rZ   c                    g r\   r   r   s    rX   validate_namesIndexCol.validate_names      rZ   c                    UR                   U l         U R                  5         U R                  U5        U R                  U5        U R	                  U5        U R                  5         g r\   )rv   validate_colvalidate_attrvalidate_metadatawrite_metadataset_attr)r   handlerr   s      rX   validate_and_setIndexCol.validate_and_set  sL    ]]
6"w'G$rZ   c           	         [        U R                  5      S:X  ac  U R                  nUbT  Uc  U R                  nUR                  U:  a)  [	        SU SU R
                   SUR                   S35      eUR                  $ g)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)rY   r  r  rH  r   rB  )r   rH  cs      rX   r  IndexCol.validate_col  s     499%1A}##}}H::($=hZ H JJ< (JJ< (<<  zz!rZ   c                    U(       aQ  [        U R                  U R                  S 5      nUb,  X R                  :w  a  [	        SU SU R                   S35      eg g g )Nzincompatible kind in col [ - rW  )r  r  rL  r  r   )r   r   existing_kinds      rX   r  IndexCol.validate_attr  s[    #DJJEM(]ii-G0s499+QO  .H( rZ   c                   U R                    H  n[        XS5      nUR                  U R                  0 5      nUR	                  U5      nX$;   ao  Ubl  XS:w  ag  US;   a?  [
        X%U4-  n[        R                  " U[        [        5       S9  SXB'   [        XS5        M  [        SU R                   SU SU SU S3	5      eUc  Uc  M  X4U'   M     g)	zg
set/update the info for this indexable with the key/value
if there is a conflict raise/warn as needed
N)r=  r?  
stacklevelzinvalid info for [z] for [z], existing_value [z] conflicts with new value [rW  )_info_fieldsr  
setdefaultrd   r   rs   warningswarnr   r   setattrr   )r   r  r   r   idxexisting_valuewss          rX   update_infoIndexCol.update_info  s    
 $$CDt,E//$))R0C WWS\Nze/N4K00/32NNBMM4AQAS
  $CHDt, %,TYYKwse D++9*: ;&&+WA/ 
 "n&@ C1 %rZ   c                x    UR                  U R                  5      nUb  U R                  R                  U5        gg)z!set my state from the passed infoN)r   rd   __dict__update)r   r  r  s      rX   set_infoIndexCol.set_info  s0    hhtyy!?MM  % rZ   c                Z    [        U R                  U R                  U R                  5        g)zset the kind for this columnN)r  r  rL  r  r   s    rX   r  IndexCol.set_attr  s    

DNNDII6rZ   c                    U R                   S:X  aK  U R                  nUR                  U R                  5      nUb   Ub  [	        X#SSS9(       d  [        S5      egggg)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   rD  read_metadatarB  r*   r   )r   r  new_metadatacur_metadatas       rX   r  IndexCol.validate_metadata	  sn    99
"==L"00<L( ,( 4T !; 	 - )	 #rZ   c                l    U R                   b'  UR                  U R                  U R                   5        gg)zset the meta dataN)rD  r  rB  )r   r  s     rX   r  IndexCol.write_metadata	  s)    ==$""4::t}}= %rZ   )rZ  rB  r=  r?  r  r   rD  rd   r  rC  rv   rA  r>  r  )NNNNNNNNNNNNN)rd   rb   rB  r#  r  r  r  r  )rC  r  r  r  r`  objectr  r,  r  )r  
np.ndarrayr_   rb   r   rb   r  z3tuple[np.ndarray, np.ndarray] | tuple[Index, Index]r8  r\   r  )r  AppendableTabler   r,  r  r  )r   r,  r  r  )r  r  r  r  )$r   r%  r&  r'  r(  r;  r)  r<  r  r   r*  rH  rL  rE  r  re  rh  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r+  r   rZ   rX   r:  r:    sq    !OT "t"/L
  )+)+ )+  
!)+V ! ! # #"	

& ? ?0. 0.580.BE0.	<0.d # # & & ; ;  !T&!>&7">rZ   r:  c                  P    \ rS rSrSr\SS j5       r        S	S jrS
S jrSr	g)GenericIndexColi	  z:an index which is not represented in the data of the tablec                    gNFr   r   s    rX   r  GenericIndexCol.is_indexed	      rZ   c                    [        U[        R                  5      (       d   [        U5      5       e[	        [        U5      5      nXU4$ )z
Convert the data from this selection to the appropriate pandas type.

Parameters
----------
values : np.ndarray
nan_rep : str
encoding : str
errors : str
)rS   rT   ru  r   r0   rm   )r   r  r   r_   r   r   s         rX   r  GenericIndexCol.convert!	  s:     &"**--;tF|;-3v;'|rZ   c                    g r\   r   r   s    rX   r  GenericIndexCol.set_attr3	  r  rZ   r   Nr  )r  r  r_   rb   r   rb   r  ztuple[Index, Index]r  )
r   r%  r&  r'  r(  r*  r  r  r  r+  r   rZ   rX   r  r  	  sA    D  58BE	$rZ   r  c                  `  ^  \ rS rSrSrSrSrSS/r            S       SU 4S jjjr\	SS j5       r
\	SS j5       rSS	 jrSS
 jrSS jrS r\SS j5       r\S 5       r\SS j5       r\S S j5       r\S 5       r\S 5       r\	S 5       r\	S 5       rS!S jrS"S jrS!S jrSrU =r$ )#DataColi7	  a  
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  c                L   > [         TU ]  UUUUUUUUU	U
US9  Xl        Xl        g )N)rd   r  r  rA  rC  rB  r>  r  rv   r   rD  )superr   rv  r  )r   rd   r  r  rA  rB  rC  r>  r  rv   r   rD  rv  r  	__class__s                 rX   r   DataCol.__init__H	  sD      	 	 	
 
	rZ   c                     U R                    S3$ )N_dtyperc   r   s    rX   
dtype_attrDataCol.dtype_attrh	  s    ))F##rZ   c                     U R                    S3$ )N_metarc   r   s    rX   	meta_attrDataCol.meta_attrl	  rN  rZ   c           
        [        [        [        U R                  U R                  U R
                  U R                  U R                  45      5      nSR                  [        / SQU5       VVs/ s H  u  p#U SU 3PM     snn5      $ s  snnf )NrS  )rd   rB  rv  r  shaperT  )
rk   rU  r@   rd   rB  rv  r  r  rV  rc  rW  s       rX   r  DataCol.__repr__p	  s    tyy$**djj$))TZZX

 xx #&&QSW"X"XJC %r%!"X
 	
rZ  c                2   ^ ^ [        UU 4S jS 5       5      $ )r\  c              3  Z   >#    U  H   n[        TUS 5      [        TUS 5      :H  v   M"     g 7fr\   r^  r_  s     rX   r  !DataCol.__eq__.<locals>.<genexpr>	  s/      
6 D!T"geQ&==6rb  )rd   rB  rv  rC  rc  rd  s   ``rX   re  DataCol.__eq__}	  s     
6
 
 	
rZ   c                ~    Uc   eU R                   b   e[        U5      u  pXl        X l         [        U5      U l        g r\   )rv  _get_data_and_dtype_namer  _dtype_to_kindr  )r   r  
dtype_names      rX   set_dataDataCol.set_data	  sA    zz!!!3D9	
":.	rZ   c                    U R                   $ )zreturn the datar  r   s    rX   r  DataCol.take_data	  s    yyrZ   c                   UR                   nUR                  nUR                  nUR                  S:X  a  SUR                  4n[        U[        5      (       a1  UR                  nU R                  XER                   R                  S9nU$ [        R                  " US5      (       d  [        U[        5      (       a  U R                  U5      nU$ [        R                  " US5      (       a  U R                  U5      nU$ [        U5      (       a  [!        5       R#                  X4S   S9nU$ [%        U5      (       a  U R'                  XC5      nU$ U R                  XBR                  S9nU$ )zG
Get an appropriately typed and shaped pytables.Col object for values.
rg   r  rn  mr   rH  r  )rv  rH  r  r  sizerS   r5   codesget_atom_datard   r   ry  r'   get_atom_datetime64get_atom_timedelta64r"   r   
ComplexColr$   get_atom_string)r  r  rv  rH  r  r   atoms          rX   	_get_atomDataCol._get_atom	  sF   
  >>;;! $Efk**LLE$$U1A1A$BD  __UC((Juo,N,N**51D  __UC((++E2D  e$$9''q'JD  U##&&u7D  $$U$<DrZ   c                6    [        5       R                  X!S   S9$ )Nr   r  r   r  r  r  rH  s      rX   r  DataCol.get_atom_string	  s    y""H!H"EErZ   c                    UR                  S5      (       a  USS nSU S3nO.UR                  S5      (       a  SnOUR                  5       nU S3n[        [        5       U5      $ )z0return the PyTables column class for this columnuint   NUIntrE   periodInt64Col)r  
capitalizer  r   )r  r  k4col_namekcaps        rX   get_atom_coltypeDataCol.get_atom_coltype	  se     ??6""abBbT~H__X&&!H??$Ds|Hwy(++rZ   c                .    U R                  US9" US   S9$ )Nr  r   r  r  r  r  r  s      rX   r  DataCol.get_atom_data	  s    ###.U1X>>rZ   c                6    [        5       R                  US   S9$ Nr   r  r   r  r  r  s     rX   r  DataCol.get_atom_datetime64	      y!!a!11rZ   c                6    [        5       R                  US   S9$ r  r   r!  s     rX   r  DataCol.get_atom_timedelta64	  r#  rZ   c                0    [        U R                  SS 5      $ )Nr  )r  r  r   s    rX   r  DataCol.shape	  s    tyy'400rZ   c                    U R                   $ r  r  r   s    rX   r  DataCol.cvalues	  s     yyrZ   c                "   U(       a  [        U R                  U R                  S5      nUb$  U[        U R                  5      :w  a  [        S5      e[        U R                  U R                  S5      nUb  X0R                  :w  a  [        S5      eggg)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  r  rL  rj   r  r   r  rv  )r   r   existing_fieldsexisting_dtypes       rX   r  DataCol.validate_attr	  s    %djj$..$GO*$t{{BS/S !WXX$TZZ$GN)n

.J V  /K) rZ   c           	        [        U[        R                  5      (       d   [        U5      5       eUR                  R
                  b  XR                     nU R                  c   eU R                  c  [        U5      u  pV[        U5      nOUnU R                  nU R                  n[        U[        R                  5      (       d   e[        U R                  5      nU R                  n	U R                  n
U R                  nUc   e[        U5      nUR!                  S5      (       a  [#        X[SS9nGOUS:X  a  [        R$                  " USS9nGOUS:X  a@   [        R$                  " U Vs/ s H  n[&        R(                  " U5      PM     sn[*        S9nOUS:X  a  U	nUR1                  5       nUc  [3        / [        R4                  S9nO`[7        U5      nUR9                  5       (       a@  UU)    nXS	:g  ==   UR;                  [<        5      R?                  5       R@                  -  ss'   [B        RD                  " XU
S
S9nO UR;                  US
S9n[        U5      S:X  a
  [I        XRX4S9nU RJ                  U4$ s  snf ! [,         aG    [        R$                  " U Vs/ s H  n[&        R.                  " U5      PM     Os  snf sn[*        S9n N|f = f! [F         a    UR;                  SS
S9n Nf = f)z
Convert the data from this selection to the appropriate pandas type.

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

Returns
-------
index : listlike to become an Index
data : ndarraylike to become a column

datetime64Tcoercetimedelta64m8[ns]rv  r   r  F)
categoriesr  validater  Or  r   r_   r   )&rS   rT   ru  r   rv  rw  rB  rA  r  r  r  rY   r   rD  r  r>  r  rz  asarrayr   fromordinalr  r   fromtimestampravelr-   float64r4   anyastyper  cumsum_valuesr5   
from_codesr   _unconvert_string_arrayr  )r   r  r   r_   r   	convertedr  r  r   rD  r  r>  rv  r  r6  r   masks                    rX   r  DataCol.convert	  s     &"**--;tF|;- <<*JJ'Fxx###:: %=V$D!I!*-DIJ99D)RZZ0000 tyy)==,,WW%%%
+ L))	d;Im#

9H=If_JJ2;<)QT%%a()<F	 Z!JOO%E
 !
 #2RZZ8
J'88::!+TE!2J2+&$++c*:*A*A*C*K*KK&#..gI
>%,,U,?	
 4 H,/XI {{I%%W = JJ4=>IqT''*I>f	@  >%,,Su,=	>sB   I; ( I6
I; ?K 6I; ;K J:
9KKK,+K,c                $   [        U R                  U R                  U R                  5        [        U R                  U R                  U R
                  5        U R                  c   e[        U R                  U R                  U R                  5        g)zset the data for this columnN)r  r  rL  r  r  r   rv  r  r   s    rX   r  DataCol.set_attrK
  sZ    

DNNDKK8

DNNDII6zz%%%

DOOTZZ8rZ   )r  rv  r  )NNNNNNNNNNNN)rd   rb   rB  r#  rv  zDtypeArg | Noner  r  r  r  )r  rI   r  r  )r  rI   r  rE   )r  rb   r  z	type[Col]r  rb   r  rE   r  )r  r  r_   rb   r   rb   )r   r%  r&  r'  r(  r;  r<  r  r   r*  r  r  r  re  r  r  classmethodr  r  r  r  r  r  r  r  r  r  r  r+  __classcell__r  s   @rX   r  r  7	  sj   
 O)$L
  !%   
 @ $ $ # #

/  > F F , , ? ? 2 2 2 2 1 1  b&H9 9rZ   r  c                  j    \ rS rSrSrSrSS jr\S 5       r\SS j5       r	\S 5       r
\S 5       rS	rg
)DataIndexableColiS
  z+represent a data column that can be indexedTc                t    [        [        U R                  5      R                  5      (       d  [	        S5      eg )N-cannot have non-object label DataIndexableCol)r$   r-   r  rv  r   r   s    rX   r  DataIndexableCol.validate_namesX
  s-    uT[[17788LMM 9rZ   c                0    [        5       R                  US9$ )N)rH  r
  r  s      rX   r   DataIndexableCol.get_atom_string]
  s    y""H"55rZ   c                *    U R                  US9" 5       $ )Nr  r  r  s      rX   r  DataIndexableCol.get_atom_dataa
  s    ###.00rZ   c                2    [        5       R                  5       $ r\   r   r!  s     rX   r  $DataIndexableCol.get_atom_datetime64e
      y!!##rZ   c                2    [        5       R                  5       $ r\   r   r!  s     rX   r  %DataIndexableCol.get_atom_timedelta64i
  rZ  rZ   r   Nr  rK  )r   r%  r&  r'  r(  r<  r  rL  r  r  r  r  r+  r   rZ   rX   rP  rP  S
  sa    5N
 6 6 1 1 $ $ $ $rZ   rP  c                      \ rS rSrSrSrg)GenericDataIndexableColin
  z(represent a generic pytables data columnr   N)r   r%  r&  r'  r(  r+  r   rZ   rX   r^  r^  n
  s    2rZ   r^  c                     \ rS rSr% SrS\S'   SrS\S'   S\S'   S	\S
'   S\S'   SrS\S'     S+         S,S jjr\	S-S j5       r
\	S.S j5       r\	S 5       rS/S jrS0S jrS1S jr\	S 5       r\	S 5       r\	S 5       r\	S 5       r\	S2S j5       r\	S-S j5       r\	S 5       rS0S jrS0S jr\	S  5       r\	S-S! j5       r\	S" 5       rS3S# jrS4S0S% jjrS-S& jr    S5   S6S' jjrS0S( jr  S7     S8S) jjr!S*r"g$)9Fixedir
  z
represent an object in my store
facilitate read/write of various types of objects
this is an abstract base class

Parameters
----------
parent : HDFStore
group : Node
    The group node where the table resides.
rb   pandas_kindru   format_typetype[DataFrame | Series]obj_typer  r  r   r   Fr,  rd  c                   [        U[        5      (       d   [        U5      5       e[        c   e[        U[        R                  5      (       d   [        U5      5       eXl        X l        [        U5      U l        X@l	        g r\   )
rS   r   r   r   rG   r   r   r`   r_   r   )r   r   r   r_   r   s        rX   r   Fixed.__init__
  sg     &(++9T&\9+%%%%11>4;>1
(2rZ   c                    U R                   S   S:*  =(       a+    U R                   S   S:*  =(       a    U R                   S   S:  $ )Nr   rg   
      )versionr   s    rX   is_old_versionFixed.is_old_version
  s:    ||A!#UQ2(=U$,,q/TUBUUrZ   c                    [        [        U R                  R                  SS5      5      n [	        S UR                  S5       5       5      n[        U5      S:X  a  US-   nU$ ! [         a    Sn U$ f = f)zcompute and set our versionpandas_versionNc              3  8   #    U  H  n[        U5      v   M     g 7fr\   )r  )r  rj  s     rX   r   Fixed.version.<locals>.<genexpr>
  s     ?,>qCFF,>s   .ri  )r   )r   r   r   )rY   r  r   r  rk   r	  rm   r   )r   rj  s     rX   rj  Fixed.version
  sx     "'$***=*=?OQU"VW	 ?GMM#,>??G7|q !D.   	 G	 s   5A# #A32A3c                V    [        [        U R                  R                  SS 5      5      $ )Nr  )rY   r  r   r  r   s    rX   r  Fixed.pandas_type
  s     wtzz':':M4PQQrZ   c                    U R                  5         U R                  nUb_  [        U[        [        45      (       a1  SR                  U Vs/ s H  n[        U5      PM     sn5      nSU S3nU R                  S SU S3$ U R                  $ s  snf )(return a pretty representation of myselfrS  [rW  12.12z	 (shape->))rE  r  rS   rj   rk   rV  r@   r  )r   rW   rj  jshapes       rX   r  Fixed.__repr__
  s    JJ=!dE]++A">Aq<?A">?xqM&&u-Yqc;; #?s   
Bc                    [        U R                  5      U R                  l        [        [        5      U R                  l        g)zset my pandas type & versionN)rb   ra  r  r  _versionrn  r   s    rX   r  Fixed.set_object_info
  s)    !$T%5%5!6

$'M

!rZ   c                2    [         R                   " U 5      nU$ r\   r8  )r   new_selfs     rX   r  
Fixed.copy
  s    99T?rZ   c                    U R                   $ r\   )rC  r   s    rX   r  Fixed.shape
  r   rZ   c                .    U R                   R                  $ r\   r   r   r   s    rX   re  Fixed.pathname
  r  rZ   c                .    U R                   R                  $ r\   )r   r   r   s    rX   r   Fixed._handle
  s    {{"""rZ   c                .    U R                   R                  $ r\   )r   r   r   s    rX   r   Fixed._filters
  s    {{###rZ   c                .    U R                   R                  $ r\   )r   r   r   s    rX   r   Fixed._complevel
  s    {{%%%rZ   c                .    U R                   R                  $ r\   )r   r   r   s    rX   r   Fixed._fletcher32
  s    {{&&&rZ   c                .    U R                   R                  $ r\   )r   r  r   s    rX   r  Fixed.attrs
  r  rZ   c                    gzset our object attributesNr   r   s    rX   	set_attrsFixed.set_attrs
      rZ   c                    g)zget our object attributesNr   r   s    rX   	get_attrsFixed.get_attrs
  r  rZ   c                    U R                   $ )zreturn my storabler   r   s    rX   storableFixed.storable
  s     zzrZ   c                    gr  r   r   s    rX   r  Fixed.is_exists
  r  rZ   c                0    [        U R                  SS 5      $ )NrC  )r  r  r   s    rX   rC  Fixed.nrows
  s    t}}gt44rZ   c                    Uc  gg)z%validate against an existing storableNTr   rd  s     rX   r7  Fixed.validate
  s    =rZ   Nc                    g)+are we trying to operate on an old version?Nr   )r   rn   s     rX   validate_versionFixed.validate_version
  r  rZ   c                D    U R                   nUc  gU R                  5         g)zZ
infer the axes of my storer
return a boolean indicating if we have a valid storer or not
FT)r  r  )r   rW   s     rX   rE  Fixed.infer_axes
  s"    
 MM9rZ   c                    [        S5      e)Nz>cannot read on an abstract storer: subclasses should implementr   r   rn   r   r   r   s        rX   r<  
Fixed.read   s     "L
 	
rZ   c                    [        S5      e)Nz?cannot write on an abstract storer: subclasses should implementr  r   r  r   s      rX   r   Fixed.write  s    !M
 	
rZ   c                    [         R                  " XU5      (       a%  U R                  R                  U R                  SS9  g[        S5      e)z[
support fully deleting the node in its entirety (only) - where
specification must be None
Tru  Nz#cannot delete on an abstract storer)rz  r{  r   r  r   r   )r   rn   r   r   s       rX   r|  Fixed.delete  s?     <<d++LL$$TZZ4$@=>>rZ   )r_   r   r   r   )rQ   r   )
r   r   r   rG   r_   r#  r   rb   r  r  r  )r  ztuple[int, int, int]r  r  )r  r`  r  )r  zLiteral[True] | Noner\   NNNNr   r  r   r  r  )r   r  r   r  r  r  )#r   r%  r&  r'  r(  r)  rb  rd  r   r*  rk  rj  r  r  r  r  r  re  r   r   r   r   r  r  r  r  r  rC  r7  r  rE  r<  r   r|  r+  r   rZ   rX   r`  r`  r
  s   
 K&&
IHd  '  	
  
 V V 	 	 R R	 2
   & & # # $ $ & & ' ' # #((     5 5:	  	
 		

 	

 HL?!+?:D?	? ?rZ   r`  c                     \ rS rSr% Sr\S\S0r\R                  5        V VVs0 s H  u  pX!_M	     snnn r	/ r
S\S'   SS jrS rS	 rSS
 jr\SS j5       rSS jrSS jrSS jrSSS jjr S       SS jjrSS jrS S jr S       S!S jjr S       S"S jjrS#S jr S$       S%S jjrSrgs  snnn f )&GenericFixedi  za generified fixed versiondatetimer  r  
attributesc                :    U R                   R                  US5      $ )N )_index_type_mapr   )r   r  s     rX   _class_to_aliasGenericFixed._class_to_alias&  s    ##''R00rZ   c                p    [        U[        5      (       a  U$ U R                  R                  U[        5      $ r\   )rS   r   _reverse_index_mapr   r-   )r   aliass     rX   _alias_to_classGenericFixed._alias_to_class)  s-    eT""L&&**5%88rZ   c           	     n   U R                  [        [        USS5      5      5      nU[        :X  a  SS jnUnOU[        :X  a  SS jnUnOUn0 nSU;   a  US   US'   U[
        L a  [        nSU;   aC  [        US   [        5      (       a  US   R                  S5      US'   OUS   US'   U[        L d   eXE4$ )	Nindex_classr  c                    [         R                  " U R                  U R                  US9n[        R                  " US S9nUb   UR                  S5      R                  U5      nU$ )N)rv  r=  rc   UTC)r6   _simple_newr  rv  r,   tz_localize
tz_convert)r  r=  r>  dtaresults        rX   rw   *GenericFixed._get_index_factory.<locals>.f8  sZ    #//MMD '223TB>#//6AA"EFrZ   c                j    [        U5      n[        R                  " XS9n[        R                  " US S9$ )Nr4  rc   )r)   r7   r  r/   )r  r=  r>  rv  parrs        rX   rw   r  E  s/    #D)"..vC"..t$??rZ   r=  r>  zutf-8r  )
r  rY   r  r,   r/   r-   r2   rS   bytesrV   )r   r  r  rw   r|  r   s         rX   _get_index_factoryGenericFixed._get_index_factory/  s    **GE="=>
 -' GK'@
 G!GU?"6]F6Ne#(5=%+u--$T{11':t  %T{t-///rZ   c                <    Ub  [        S5      eUb  [        S5      eg)z5
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   rn   s      rX   validate_readGenericFixed.validate_read`  s=     T  Y  rZ   c                    g)NTr   r   s    rX   r  GenericFixed.is_existso  s    rZ   c                p    U R                   U R                  l         U R                  U R                  l        gr  )r_   r  r   r   s    rX   r  GenericFixed.set_attrss  s"    "mm

 KK

rZ   c                   [        [        U R                  SS5      5      U l        [	        [        U R                  SS5      5      U l        U R                   H-  n[        X[	        [        U R                  US5      5      5        M/     g)retrieve our attributesr_   Nr   r   )r`   r  r  r_   rY   r   r  r  )r   r  s     rX   r  GenericFixed.get_attrsx  s^    (Z)NO%gdjj(H&MNAD_WTZZD-IJK !rZ   c                $    U R                  5         g r\   )r  r  s      rX   r   GenericFixed.write  s    rZ   Nc                   SSK n[        U R                  U5      nUR                  n[        USS5      n[	        XTR
                  5      (       a  US   X# nO[        [        USS5      5      n	[        USS5      n
U
b  [        R                  " XS9nOXRU nU	(       a.  U	R                  S5      (       a  [        US	S5      n[        XS
S9nOU	S:X  a  [        R                  " USS9nU(       a  UR                  $ U$ )z2read an array for the specified node (off of groupr   N
transposedF
value_typer  r4  r/  r>  Tr0  r2  r3  )r   r  r   r  rS   VLArrayrY   rT   r  r  rz  r;  T)r   r   r   r   r   r   r  r  retrv  r  r>  s               rX   
read_arrayGenericFixed.read_array  s    tzz3'UL%8
dNN++q'%%C#GE<$FGEE7D1E hhu2&)),77UD$/cd3-'jjH555LJrZ   c                    [        [        U R                  U S35      5      nUS:X  a  U R                  XUS9$ US:X  a(  [        U R                  U5      nU R                  XRUS9nU$ [        SU 35      e)N_varietymultir   r   regularzunrecognized index variety: )rY   r  r  read_multi_indexr   read_index_noder   )r   r   r   r   varietyr   r   s          rX   
read_indexGenericFixed.read_index  s     "'$**X6F"GHg(((EE	!4::s+D(((FEL:7)DEErZ   c                X   [        U[        5      (       a,  [        U R                  U S3S5        U R	                  X5        g [        U R                  U S3S5        [        SX R                  U R                  5      nU R                  XR                  5        [        U R                  U5      nUR                  UR                  l        UR                  UR                  l        [        U[        [         45      (       a)  U R#                  [%        U5      5      UR                  l        [        U[        [         [(        45      (       a  UR*                  UR                  l        [        U[        5      (       a3  UR,                  b%  [/        UR,                  5      UR                  l        g g g )Nr  r  r  r   )rS   r.   r  r  write_multi_index_convert_indexr_   r   write_arrayr  r  r   r  r  rd   r,   r/   r  r   r  r2   r=  r>  _get_tz)r   r   r   rF  r   s        rX   write_indexGenericFixed.write_index  s*   eZ((DJJ3%x 0':""3.DJJ3%x 0)<&w}}dkkRIS"2"234::s+D!*DMM!&DMM%-!=>>,0,@,@e,M)%-n!MNN%*ZZ"%//EHH4H#*588#4  5I/rZ   c                   [        U R                  U S3UR                  5        [        [	        UR
                  UR                  UR                  5      5       H  u  nu  pEn[        UR                  [        5      (       a  [        S5      eU SU 3n[        XtU R                  U R                  5      nU R                  XxR                   5        [#        U R$                  U5      n	UR&                  U	R(                  l        XiR(                  l        [        U	R(                  U SU 3U5        U SU 3n
U R                  X5        M     g )N_nlevelsz=Saving a MultiIndex with an extension dtype is not supported._level_name_label)r  r  r  	enumeraterc  levelsr   namesrS   rv  r(   r   r  r_   r   r  r  r  r   r  r  rd   )r   r   r   ilevlevel_codesrd   	level_key
conv_levelr   	label_keys              rX   r  GenericFixed.write_multi_index  s   

se8,emm<+4ekk5;;7,
'A'$ #))^44)S  %vaS)I'	t{{SJY(9(9:4::y1D!+DMM!%MM DMMcU%v#6= %vaS)IY4),
rZ   c                |   [        U R                  U S35      n/ n/ n/ n[        U5       H  nU SU 3n	[        U R                  U	5      n
U R	                  XUS9nUR                  U5        UR                  UR                  5        U SU 3nU R                  XUS9nUR                  U5        M     [        XVUSS9$ )Nr  r  r  r  T)r  r   r  r[  )	r  r  r  r   r  r   rd   r  r.   )r   r   r   r   r  r  r   r  r  r  r   r  r  r   s                 rX   r  GenericFixed.read_multi_index  s     $**X&67 "wA%vaS)I4::y1D&&tt&DCMM#LL"%vaS)I//)t/LKLL%   ed
 	
rZ   c           	        XU nSUR                   ;   ak  [        R                  " UR                   R                  5      S:X  a=  [        R                  " UR                   R                  UR                   R
                  S9n[        UR                   R                  5      nS nSUR                   ;   a*  [        UR                   R                  5      n[        U5      nUR                   nU R                  U5      u  pUS;   a-  U" [        XEU R                  U R                  S94S[        0U	D6n
O&U" [        XEU R                  U R                  S940 U	D6n
Xjl	        U
$ )Nr  r   r4  rd   )r   r  r  rv  )r  rT   prodr  r  r  rY   r  re   rd   r  _unconvert_indexr_   r   r  )r   r   r   r   r  r  rd   r  r|  r   r   s              rX   r  GenericFixed.read_index_node  s/    $ dmm#0C0C(D(I88DMM//t}}7O7OPDt}}112T]]"t}}112D"4(D11%8%% t{{ 	
 E  t{{ 	E 
rZ   c                @   [         R                  " SUR                  -  5      nU R                  R	                  U R
                  X5        [        U R
                  U5      n[        UR                  5      UR                  l
        UR                  UR                  l        g)zwrite a 0-len array)rg   N)rT   r  r  r   create_arrayr   r  rb   rv  r  r  r  )r   r   r   arrr   s        rX   write_array_emptyGenericFixed.write_array_empty  sh     hhtejj()!!$**c7tzz3'#&u{{#3 #kkrZ   c                   [        USS9nXR                  ;   a&  U R                  R                  U R                  U5        UR                  S:H  nSn[        UR                  [        5      (       a  [        S5      eU(       d  [        US5      (       a  UR                  nSnS nU R                  bE  [        [        5         [        5       R                  R!                  UR                  5      nS S S 5        UbZ  U(       d@  U R                  R#                  U R                  XUR$                  U R                  S9nXHS S & GOU R'                  X5        GOUR                  R(                  [*        R,                  :X  a  [.        R0                  " USS9n	U(       a  O4U	S	:X  a  O-[2        XU4-  n
[4        R6                  " U
[8        [;        5       S
9  U R                  R=                  U R                  U[        5       R?                  5       5      nURA                  U5        GO[.        RB                  " UR                  S5      (       ao  U R                  RE                  U R                  XRG                  S5      5        [I        UR                  5      [K        U R                  U5      RL                  l'        GOs[        UR                  [P        5      (       a  U R                  RE                  U R                  XRR                  5        [K        U R                  U5      n[U        URV                  5      URL                  l+        SUR                  RX                   S3URL                  l'        O[.        RB                  " UR                  S5      (       a[  U R                  RE                  U R                  XRG                  S5      5        S[K        U R                  U5      RL                  l'        O?U(       a  U R'                  X5        O&U R                  RE                  U R                  X5        U[K        U R                  U5      RL                  l-        g ! , (       d  f       GNc= f)NT)extract_numpyr   Fz]Cannot store a category dtype in a HDF5 dataset that uses format="fixed". Use format="table".r  )r   skipnar  r  rn  ro  datetime64[rW  r  r2  ).r:   r   r   r  r  rS   rv  r&   r   rk  r  r   r   r   r   Atom
from_dtypecreate_carrayr  r  r   rT   object_r   infer_dtypert   r  r  r   r   create_vlarray
ObjectAtomr   ry  r  viewrb   r  r  r  r'   asi8r  r>  unitr  )r   r   r  r!  r   empty_arrayr  r  cainferred_typer  vlarrr   s                rX   r  GenericFixed.write_array(  s    c6**LL$$TZZ5 jjAo
ekk#344%/  uc""!
==$*%y~~00= & 
 \\//JJ5;; 0  1 &&s2[[+  OOE%@M(*$E'BBb"4AQASTLL//

CAUAUAWXELL__U[[#..LL%%djj#zz$7GH;>u{{;KGDJJ$--8_55 LL%%

C 4::s+D  'uxx0DMM)4U[[5E5E4Fa'HDMM$__U[[#..LL%%djj#zz$7GH;HGDJJ$--8""3.LL%%djj#=7A

C ))4w &%s   ?.Q		
Qr  r  r  r  r  r  )r   rb   r   r  r   r  r  r-   )r   rb   r   r-   r  r  )r   rb   r   r.   r  r  )r   rb   r   r  r   r  r  r.   )r   rG   r   r  r   r  r  r-   )r   rb   r   rI   r  r  r\   )r   rb   r  rH   r!  zIndex | Noner  r  )r   r%  r&  r'  r(  r,   r/   r  r!  r  r  r)  r  r  r  r  r*  r  r  r  r   r  r  r  r  r  r  r  r  r+  )r  ri  r  s   000rX   r  r    s]   $$j+xHO+:+@+@+BC+B41!$+BCJ	19/b  (
L F FJFF)F8BF	F5.54 FJ

)
8B
	
0 HL$$!+$:D$	$L* BFXBXB)XB2>XB	XB XBM Ds   B<r  c                  r   ^  \ rS rSr% SrS/rS\S'   \S 5       r    S	     S
S jjr	SU 4S jjr
SrU =r$ )r  i  r  rd   rA   c                p     [        U R                  R                  5      4$ ! [        [        4 a     g f = fr\   )rm   r   r  r   r   r   s    rX   r  SeriesFixed.shape  s6    	

))*,,>* 		s   " 55c                    U R                  X!5        U R                  SX4S9nU R                  SX4S9n[        XeU R                  SS9n[        5       (       a   [        USS9(       a  UR                  S5      nU$ )	Nr   r  r  F)r   rd   r  Tr  string[pyarrow_numpy])r  r  r  r1   rd   r   r   rA  )r   rn   r   r   r   r   r  r  s           rX   r<  SeriesFixed.read  sn     	7*u@B$))%H%''OF4,P]]#:;FrZ   c                   > [         TU ]  " U40 UD6  U R                  SUR                  5        U R	                  SU5        UR
                  U R                  l        g )Nr   r  )r  r   r  r   r  rd   r  )r   r  r   r  s      rX   r   SeriesFixed.write  sG    c$V$#)),3'((

rZ   r   r  r   r  r   r  r  r1   r  )r   r%  r&  r'  ra  r  r)  r*  r  r<  r   r+  rM  rN  s   @rX   r  r    sa    KJ
N    	
  
# #rZ   r  c                  t   ^  \ rS rSr% SS/rS\S'   \S	S j5       r    S
     SS jjrSU 4S jjr	Sr
U =r$ )BlockManagerFixedi  r  nblocksr  c                x    U R                   nSn[        U R                  5       H6  n[        U R                  SU S35      n[        USS 5      nUc  M/  X%S   -  nM8     U R                  R
                  n[        USS 5      nUb  [        USUS-
   5      nO/ nUR                  U5        U$ ! [         a     g f = f)Nr   block_itemsr  rg   )	r  r  r/  r  r   block0_valuesrj   r   r   )r   r  r!  r  r   r  s         rX   r  BlockManagerFixed.shape  s    	99D E4<<(tzzU1#V+<=gt4$1X%E	 ) ::++DD'40E U1q23LLL 		s   AB, AB, ,
B98B9c                $   U R                  X!5        U R                  5       R                  S5      n/ n[        U R                  5       H3  nXu:X  a  X44OSu  pU R                  SU 3XS9n
UR                  U
5        M5     US   n/ n[        U R                  5       H  nU R                  SU S35      nU R                  SU S3WW	S9nXR                  U5         n[        UR                  X&S   S	S
9n[        5       (       a   [        USS9(       a  UR                  S5      nUR                  U5        M     [        U5      S:  a<  [!        USSS9n[#        5       (       a  UR%                  5       nUR'                  US	S9nU$ [        US   US   S9$ )Nr   r  rZ  r  r1  r2  rC  rg   Fr   r   r  Tr  r(  )rZ  r  )r   r  r   r   )r  rd  _get_block_manager_axisr  r  r  r   r/  r  r  r+   r  r   r   rA  rm   r3   r   r  r  )r   rn   r   r   r   select_axisr  r  r=  r>  axr!  dfs	blk_itemsr  dfouts                    rX   r<  BlockManagerFixed.read  s|    	7*mmo==a@tyy!A-.-=UM<MF4s6FBKKO "
 Qt||$A%s&(9:I__uQCw%7vE_RF--i89G688WG%PB)++t0TYY67JJrN % s8a<140C"$$ hhj++e%+8CJaQ88rZ   c                  > [         TU ]  " U40 UD6  [        UR                  [        5      (       a  UR                  S5      nUR                  nUR                  5       (       d  UR                  5       nUR                  U R                  l        [        UR                  5       H<  u  pEUS:X  a  UR                  (       d  [        S5      eU R                  SU 3U5        M>     [        UR                   5      U R                  l        [        UR                   5       H_  u  pFUR$                  R'                  UR(                  5      nU R+                  SU S3UR,                  US9  U R                  SU S3U5        Ma     g )Nr1  r   z/Columns index has to be unique for fixed formatrZ  rC  )r!  r2  )r  r   rS   _mgrr<   _as_manageris_consolidatedconsolidater  r  r  r  	is_uniquer   r  rm   blocksr/  r!  r  mgr_locsr  r  )	r   r  r   r  r  r:  blkr<  r  s	           rX   r   BlockManagerFixed.write  s+   c$V$ chh--//'*Cxx##%%##%D))

tyy)EAAvr|| !RSStA3Z, * !-

,FA

5IuQCw/9MuQCv.	:	 -rZ   r   )r  zShape | Noner  )r   r  r   r  r  r+   r  )r   r%  r&  r'  r  r)  r*  r  r<  r   r+  rM  rN  s   @rX   r.  r.    s`    )$JL 8  '9 	'9
 '9 
'9R; ;rZ   r.  c                      \ rS rSrSr\rSrg)r  i	  r  r   N)r   r%  r&  r'  ra  r+   rd  r+  r   rZ   rX   r  r  	  s    KHrZ   r  c                    ^  \ rS rSr% SrSrSrS\S'   S\S'   SrS	\S
'   Sr	S\S'           S5                   S6U 4S jjjr
\S7S j5       rS7S jrS8S jrS9S jr\S:S j5       r    S;S jr\S<S j5       r\S:S j5       r\S 5       r\S 5       r\S 5       r\S 5       r\S=S j5       r\S<S j5       r\S:S j5       r\S>S j5       rS?S jrS  rS@S! jrSAS" jrSBS# jr SCS$ jr!S9S% jr"S9S& jr#SDS9S' jjr$S9S( jr%\&S) 5       r' SE   SFS* jjr( SG     SHS+ jjr)\*SIS, j5       r+S- r,    SJ   SKS. jjr-\.    SLS/ j5       r/SDSMS0 jjr0        SNS1 jr1 SE   SOS2 jjr2   SE     SPS3 jjr3S4r4U =r5$ )Qr  i  a  
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_tablerv   rb   rb  r  rg   zint | list[Hashable]r  Trj   rD  c                   > [         TU ]  XX4S9  U=(       d    / U l        U=(       d    / U l        U=(       d    / U l        U=(       d    / U l        U	=(       d    0 U l        Xl        g )Nr  )r  r   
index_axesrf  values_axesr   r  r   )r   r   r   r_   r   rN  rf  rO  r   r  r   r  s              rX   r   Table.__init__.  sZ     	I$*,2&,"(.BJB	rZ   c                >    U R                   R                  S5      S   $ )N_r   )r  r	  r   s    rX   table_type_shortTable.table_type_shortC  s    $$S)!,,rZ   c                4   U R                  5         [        U R                  5      (       a  SR                  U R                  5      OSnSU S3nSnU R                  (       a;  SR                  U R
                   Vs/ s H  n[        U5      PM     sn5      nSU S3nSR                  U R                   Vs/ s H  ofR                  PM     sn5      nU R                  S U SU R                   S	U R                   S
U R                   SU SU S3$ s  snf s  snf )rv  rS  r  z,dc->[rW  rq  rw  rx  z (typ->z,nrows->z,ncols->z,indexers->[ry  )rE  rm   r   rV  rk  rj  rb   rN  rd   r  rS  rC  ncols)r   jdcr  verrj  jverr   jindex_axess           rX   r  Table.__repr__G  s   -01B1B-C-Cchht(()cU!_88T\\:\SV\:;DdV1+Chh@1@A&se ,**+8DJJ< @jj\k]!B4qB	
	 ;  As   :D5Dc                P    U R                    H  nXR                  :X  d  M  Us  $    g)zreturn the axis for cN)r  rd   )r   r  r   s      rX   r   Table.__getitem__Y  s#    AFF{  rZ   c                f   Uc  gUR                   U R                   :w  a&  [        SUR                    SU R                    S35      eS Hg  n[        XS5      n[        XS5      nX4:w  d  M"  [        U5       H#  u  pVXE   nXg:w  d  M  [	        SU SU SU S35      e   [        SU SU SU S35      e   g)	z"validate against an existing tableNz'incompatible table_type with existing [r  rW  )rN  rf  rO  zinvalid combination of [z] on appending data [z] vs current table [)r  r   r  r  r   rx  )r   r`  r  svovr  saxoaxs           rX   r7  Table.validate`  s    =t.$$%S(9< 
 AA$'B4(Bx (mFA%Cz(6qc :  #u$8Q@ 	 ,  .qc1Frd K&&(T, # ArZ   c                6    [        U R                  [        5      $ )z@the levels attribute is 1 or a list in the case of a multi-index)rS   r  rj   r   s    rX   is_multi_indexTable.is_multi_index  s     $++t,,rZ   c                    [         R                  " UR                  R                  5      n UR	                  5       n[        U[        5      (       d   eX24$ ! [
         a  n[        S5      UeSnAff = f)zM
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)rz  fill_missing_namesr   r  reset_indexr   rS   r+   )r   r  r  	reset_objr}  s        rX   validate_multiindexTable.validate_multiindex  sp     ''		8	)I
 )Y////    	T	s   A 
A1 A,,A1c                    [         R                  " U R                   Vs/ s H  oR                  R                  S   PM     sn5      $ s  snf )z-based on our axes, compute the expected nrowsr   )rT   r  rN  r  r  r   r  s     rX   nrows_expectedTable.nrows_expected  s4     wwDOODOq		*ODEEDs   "Ac                     SU R                   ;   $ )zhas this table been createdrv   r  r   s    rX   r  Table.is_exists  s     $**$$rZ   c                0    [        U R                  SS 5      $ Nrv   r  r   r   s    rX   r  Table.storable  s    tzz7D11rZ   c                    U R                   $ )z,return the table group (this is my storable))r  r   s    rX   rv   Table.table  s     }}rZ   c                .    U R                   R                  $ r\   )rv   rv  r   s    rX   rv  Table.dtype  s    zzrZ   c                .    U R                   R                  $ r\   r  r   s    rX   r  Table.description  r  rZ   c                X    [         R                  " U R                  U R                  5      $ r\   )ra  rb  rN  rO  r   s    rX   r  
Table.axes  s    t0@0@AArZ   c                :    [        S U R                   5       5      $ )z.the number of total columns in the values axesc              3  L   #    U  H  n[        UR                  5      v   M     g 7fr\   )rm   r  )r  r   s     rX   r  Table.ncols.<locals>.<genexpr>  s     ;*:Q3qxx==*:s   "$)sumrO  r   s    rX   rV  Table.ncols  s     ;$*:*:;;;rZ   c                    gr  r   r   s    rX   is_transposedTable.is_transposed  r  rZ   c                    [        [        R                  " U R                   Vs/ s H  n[	        US   5      PM     snU R
                   Vs/ s H  n[	        UR                  5      PM     sn5      5      $ s  snf s  snf )z@return a tuple of my permutated axes, non_indexable at the frontr   )rk   ra  rb  rf  r  rN  rZ  r   r   s     rX   data_orientationTable.data_orientation  sc     OO$($7$78$7qQqT$78&*oo6oQVVo6
 	
86s   A6A;c                z   SSS.nU R                    Vs/ s H  o"R                  U4PM     nnU R                   VVs/ s H  u  pEX   S4PM     nnnU R                   Vs/ s H5  owR                  [        U R                  5      ;   d  M'  UR                  U4PM7     nn[        X6-   U-   5      $ s  snf s  snnf s  snf )z<return a dict of the kinds allowable columns for this objectr   r   r   rg   N)rN  rB  rf  rO  rd   r  r   r  )	r   
axis_namesr   d1rZ  r  d2r  d3s	            rX   
queryablesTable.queryables  s     !Y/
 %)OO4OqwwlO4;?;N;NO;N<4z&;NO"&"2"2
"2QffDDUDU@V6VLQWWaL"2 	 
 BGbL!! 5O
s   B-B2&B8	B8c                p    U R                    Vs/ s H  oR                  UR                  4PM     sn$ s  snf )zreturn a list of my index cols)rN  rZ  rB  rn  s     rX   
index_colsTable.index_cols  s+     ,0??;?a!?;;;s   !3c                X    U R                    Vs/ s H  oR                  PM     sn$ s  snf )zreturn a list of my values cols)rO  rB  rn  s     rX   values_colsTable.values_cols  s$    !%!1!12!1A!1222s   'c                >    U R                   R                  nU SU S3$ )z)return the metadata pathname for this keyz/meta/z/metar  r8  s      rX   _get_metadata_pathTable._get_metadata_path  s$    

&&se5))rZ   c           	         U R                   R                  U R                  U5      [        USS9SU R                  U R
                  U R                  S9  g)zs
Write out a metadata array to the key as a fixed-format Series.

Parameters
----------
key : str
values : ndarray
Fr8  rv   )r   r_   r   r   N)r   r   r  r1   r_   r   r   )r   r   r  s      rX   r  Table.write_metadata  sI     	##C(6&]];;LL 	 	
rZ   c                    [        [        U R                  SS5      US5      b*  U R                  R                  U R	                  U5      5      $ g)z'return the meta data array for this keyr   N)r  r   r   r   r  r   s     rX   r  Table.read_metadata  sA    74::vt4c4@L;;%%d&=&=c&BCCrZ   c                B   [        U R                  5      U R                  l        U R                  5       U R                  l        U R	                  5       U R                  l        U R
                  U R                  l        U R                  U R                  l        U R                  U R                  l        U R                  U R                  l        U R                  U R                  l	        U R                  U R                  l
        U R                  U R                  l        g)zset our table type & indexablesN)rb   r  r  r  r  rf  r   r   r_   r   r  r  r   s    rX   r  Table.set_attrs  s     #DOO 4

 $ 1

!%!1!1!3

$($7$7

!"&"3"3

!\\

"mm

 KK

 KK

))

rZ   c                   [        U R                  SS5      =(       d    / U l        [        U R                  SS5      =(       d    / U l        [        U R                  SS5      =(       d    0 U l        [        U R                  SS5      U l        [        [        U R                  SS5      5      U l        [        [        U R                  SS5      5      U l	        [        U R                  S	S5      =(       d    / U l
        U R                   Vs/ s H  oR                  (       d  M  UPM     snU l        U R                   Vs/ s H  oR                  (       a  M  UPM     snU l        gs  snf s  snf )
r  rf  Nr   r  r   r_   r   r   r  )r  r  rf  r   r  r   r`   r_   rY   r   r  
indexablesr;  rN  rO  r  s     rX   r  Table.get_attrs
  s    %djj2BDIOR#DJJEKDJJ5;	tzz9d;(Z)NO%gdjj(H&MN&-djj(D&I&OR&*ooKo9J9J1oK'+P!>O>OAP LPs   	E$!E$=E)E)c           	         Ubq  U R                   (       a_  [        SR                  U R                   Vs/ s H  n[	        U5      PM     sn5      -  n[
        R                  " U[        [        5       S9  gggs  snf )r  Nrq  r  )	rk  rr   rV  rj  rb   r  r  r   r   )r   rn   rj  r  s       rX   r  Table.validate_version  s`    ""(388T\\4R\SV\4R+SS*/1 # 4Rs   A6
c                    Uc  g[        U[        5      (       d  gU R                  5       nU H  nUS:X  a  M  X2;  d  M  [        SU S35      e   g)zp
validate the min_itemsize doesn't contain items that are not in the
axes this needs data_columns to be defined
Nr  zmin_itemsize has the key [z%] which is not an axis or data_column)rS   r  r  r   )r   r   qri  s       rX   validate_min_itemsizeTable.validate_min_itemsize!  s`    
 ,--OOAH}z 0 4" "  rZ   c                b  ^ ^^^^ / nT R                   mT R                  R                  m[        T R                  R                  5       Hi  u  nu  p4[        TU5      nT R                  U5      nUb  SOSnU S3n[        TUS5      n	[        UUUU	UT R                  UUS9n
UR                  U
5        Mk     [        T R                  5      m[        U5      mUUUU U4S jnUR                  [        T R                  R                  5       VVs/ s H  u  p,U" X,5      PM     snn5        U$ s  snnf )z/create/cache the indexables if they don't existNr  rK  )rd   rZ  rC  r  rA  rv   r   rD  c                n  > [        U[        5      (       d   e[        nUT;   a  [        n[	        TU5      n[        UTR                  5      n[	        TU S3S 5      n[	        TU S3S 5      n[        U5      nTR                  U5      n[	        TU S3S 5      n	U" UUUUTU -   UTR                  U	UUS9
n
U
$ )NrK  r  r  )
rd   rB  r  r  rC  rA  rv   r   rD  rv  )
rS   rb   r  rP  r  _maybe_adjust_namerj  r  r  rv   )r  r  klassr  adj_namer  rv  r  mdr   r  base_posr  descr   table_attrss              rX   rw   Table.indexables.<locals>.fY  s    a%%%%EBw(4#D)!T\\:H [XJe*<dCFKH:V)<dCE "%(D##A&B ;8*E(:DADqLjjC JrZ   )r  rv   r  r  r  r  r  r:  r   r  r   rm   r  r  )r   _indexablesr  rZ  rd   r  r  r   rL  r  	index_colrw   r  r  r  r  r  s   `            @@@@rX   r  Table.indexables6  s%    jj&&
  ))>)>?OA|4&D##D)B!#:TD&I;	48D jj	I y)%  @* ""#{#!	 !	J 		$**:P:P0QR0QAaG0QRS Ss   D+
c           
     X   U R                  5       (       d  gUSL a  gUb  USL a8  U R                   Vs/ s H!  oDR                  (       d  M  UR                  PM#     nn[	        U[
        [        45      (       d  U/n0 nUb  X%S'   Ub  X5S'   U R                  nU GH  n[        UR                  US5      nUb  UR                  (       a^  UR                  n	U	R                  n
U	R                  nUb  X:w  a  UR                  5         OXS'   Ub  X:w  a  UR                  5         OXS'   UR                  (       d?  UR                  R!                  S5      (       a  [#        S5      eUR$                  " S0 UD6  M  M  XpR&                  S   S	   ;   d  M  [)        S
U SU SU S35      e   gs  snf )a  
Create a pytables index on the specified columns.

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

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

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

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

Notes
-----
Cannot index Time64Col or ComplexCol.
Pytables must be >= 3.0.
NFTr  r  complexzColumns containing complex values can be stored but cannot be indexed when using table format. Either use fixed format, set index=False, or do not include the columns containing complex values to data_columns when initializing the table.r   rg   zcolumn z/ is not a data_column.
In order to read column z: you must reload the dataframe 
into HDFStore and include z  with the data_columns argument.r   )rE  r  r<  rB  rS   rk   rj   rv   r  r  r  r   r  r  remove_indexr   r  r   r  rf  r   )r   r   r  r  r   kwrv   r  r  r   cur_optlevelcur_kinds               rX   r  Table.create_index  s   <   e ?go(,		I	15H5Hwqww	GI'E4=11iG%zNvJ

A

At,A}<<GGE#(>>L$zzH'H,<(%-6
+0H()5: ||vv((33'H  NN(R( $ ))!,Q//$aS !//0c 21123SU A  Js   F'F'c                   [        XX#S9nUR                  5       n/ nU R                   H_  nUR                  U R                  5        UR                  UU R                  U R                  U R                  S9nUR                  U5        Ma     U$ )z
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]]
rK  r:  )
	Selectionr   r  r  r  r  r   r_   r   r   )	r   rn   r   r   	selectionr  r6  r   ress	            rX   
_read_axesTable._read_axes  s    " duH	!!#AJJtyy!)){{	  C NN3  rZ   c                    U$ )zreturn the data for this objr   r  r  r  s      rX   
get_objectTable.get_object  s	     
rZ   c                   [        U5      (       d  / $ US   u  pEU R                  R                  U0 5      nUR                  S5      S:X  a  U(       a  [        SU SU 35      eUSL a  [	        U5      nOUc  / n[        U[        5      (       aU  [        U5      n[	        U5      nUR                  UR                  5        Vs/ s H  nUS:w  d  M  X;  d  M  UPM     sn5        U V	s/ s H  oU;   d  M
  U	PM     sn	$ s  snf s  sn	f )zL
take the input data_columns and min_itemize and create a data
columns spec
r   r   r.   z"cannot use a multi-index on axis [z] with data_columns Tr  )
rm   r  r   r   rj   rS   r  r  r  r  )
r   r   r   rf  rZ  axis_labelsr  existing_data_columnsri  r  s
             rX   validate_data_columnsTable.validate_data_columns  s   
 >""I*1-yy}}T2&88F|+4TF ;  ,~/  4,L!L lD))$'$5!-L *..00H} )*)G 0 (<<a+;<<< =s   
C=C=C='	D4Dc                  ^ [        U[        5      (       d1  U R                  R                  n[	        SU S[        U5       S35      eTc  S/mT Vs/ s H  oR                  U5      PM     snmU R                  5       (       aJ  Sn	U R                   Vs/ s H  oR                  PM     snm[        U R                  5      nU R                  nOSn	U R                  n
U R                  S:X  d   e[        T5      U R                  S	-
  :w  a  [!        S
5      e/ nUc  Sn[#        U4S jS 5       5      nUR$                  U   n[        U5      nU	(       a  [        U5      nU R&                  U   S	   n[)        [*        R,                  " U5      [*        R,                  " U5      SSS9(       dM  [)        [*        R,                  " [/        U5      5      [*        R,                  " [/        U5      5      SSS9(       a  UnU
R1                  U0 5      n[        UR2                  5      US'   [        U5      R4                  US'   UR7                  X45        TS   nUR$                  U   nUR9                  U5      n[;        UXR<                  U R>                  5      nUUl	        URA                  S5        URC                  U
5        URE                  U5        U/n[        U5      nUS	:X  d   e[        U5      S	:X  d   eU H  n[G        X(S   US	   5      nM     UR                  S	:H  nU RI                  XVU5      nU RK                  UU5      RM                  5       nU RO                  UXU RP                  U5      u  nn/ n[S        [U        UU5      5       GH  u  nu  nn[V        nSnU(       aF  [        U5      S	:X  a7  US   U;   a.  [X        nUS   nUb   [        U[Z        5      (       d  [!        S5      eU	(       a  U(       a   U RP                  U   nOSnU=(       d    SU 3n![a        U!URb                  UUUU R<                  U R>                  US9n"[e        U!U Rf                  5      n#URi                  U"5      n$[k        U"Rl                  Rn                  5      n%Sn&[q        U"SS5      b  [s        U"Rt                  5      n&S=n'=n(n)[        U"Rl                  [v        5      (       a<  U"Rx                  n)Sn'[*        Rz                  " U"R|                  5      R                  5       n([        U"5      u  n*n+U" U#U![        U5      U$UU%U&U)U'U(U+U*S9n,U,RC                  U
5        UR7                  U,5        US	-  nGM     U V,s/ s H"  n,U,R                  (       d  M  U,Rn                  PM$     n-n,[        U 5      " U R                  U R                  U R<                  U R>                  UUUU-U
US9
n.[        U S5      (       a  U R                  U.lD        U.R                  U5        U(       a  U	(       a  U.R                  U 5        U.$ s  snf s  snf ! [\        [^        4 a"  n [!        SU SU RP                   S35      U eSn A ff = fs  sn,f )a  
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  rW  Nr   TFri  rg   z<currently only support ndim-1 indexers in an AppendableTablenanc              3  6   >#    U  H  oT;  d  M
  Uv   M     g 7fr\   r   )r  rj  r  s     rX   r  %Table._create_axes.<locals>.<genexpr>n  s     6f11fs   		r  r  r  r   rR  zIncompatible appended table [z]with existing table [values_block_)existing_colr   r   r_   r   r   r>  r  )rd   rB  r  rA  rC  r  r>  r  r   rD  rv  r  )
r   r   r_   r   rN  rf  rO  r   r  r   r  )GrS   r+   r   r   r   r   _get_axis_numberrE  rN  rZ  rj   r   r   r  r  rm   r   r  r  rf  r*   rT   arrayr  r  r  r   r   _get_axis_namer  r_   r   rE  r  r  _reindex_axisr  r  r\  _get_blocks_and_itemsrO  r  rc  r  rP  rb   
IndexErrorr   _maybe_convert_for_string_atomr  r  rj  r  r  rv  rd   r  r  r>  r&   r  r;  r6  r>  r  r<  r   rk  r  r  r7  )/r   r  r  r7  r   r   r   r   r   table_existsnew_infonew_non_index_axesr  append_axisindexer
exist_axisr  	axis_name	new_indexnew_index_axesjr  r  rF  r<  vaxesr  rH  b_itemsr  rd   r  r}  new_namedata_convertedr  rA  r  r>  r   rD  r  r  r  r  dcs	new_tables/    `                                             rX   _create_axesTable._create_axes%  s   @ #y))JJ&&EA% Is)A'  <3D 266A$$Q'6 ??L$(OO4OqFFO4D 1 12LllG !L99yyA~~t9		A%N 
 $& ?G 6f66HHSM1g,-G,,W5a8J#%$ 	 $HHVK01HHVJ/0# $	 #-K ""3+QWWWAw''V!!3"45 1gHHSM&&s+	"9aL		 	!h'  .#Avv %&!+++#AqT1Q40C $ ^^q(
 11(:
 Z0==? 66<T5E5E|
	
 !*3vy+A!BA~WED G 1gajL6P(qz
4(=(=$%TUU #'#3#3A#6L  $2qc2H;

)){{	N *(DLLAH//.1C!."6"6";";<DB~tT2>^../(,,D,8g...0@AA(00!::n&?&?@FFH7GD*G}! C OOH%LLFAS "CV $)B5CC,A,Axsxx5BJ;;**]];;%-
	 4""#{{I''5t$E 7
 5^ #H- $7x @0040@0@/AD n Cs0   X#X(2X-$Y"=Y"-Y=YYc           
        [        U R                  [        5      (       a  U R                  S5      n S nU R                  n[	        [
        U5      n[        UR                  5      nU" U5      n[        U5      (       a  US   u  p[        U
5      R                  [        U5      5      nU R                  XS9R                  n[	        [
        U5      n[        UR                  5      nU" U5      nU H`  nU R                  U/U	S9R                  n[	        [
        U5      nUR                  UR                  5        UR                  U" U5      5        Mb     U(       a  [        Xx5       VVs0 s H   u  p[        UR                  5       5      X4_M"     nnn/ n/ nU HN  n[        UR                   5      n UR#                  U5      u  pUR%                  U5        UR%                  U5        MP     UnUnXx4$ s  snnf ! [&        [(        4 aF  nSR+                  U Vs/ s H  n[-        U5      PM     Os  snf sn5      n[/        SU S35      UeS nAff = f)Nr1  c                    U R                    Vs/ s H'  oR                  R                  UR                  5      PM)     sn$ s  snf r\   )rF  r!  r  rG  )mgrrH  s     rX   get_blk_items2Table._get_blocks_and_items.<locals>.get_blk_items#  s-    <?JJGJSIINN3<<0JGGGs   .A r   r  rS  z+cannot match existing table structure for [z] on appending data)rS   rA  r<   rB  r   r=   rj   rF  rm   r-   r  r  r  rc  rk   tolistr  rg  r   r  r   rV  r@   r   )r  r  r  rO  r   r  r  rF  r<  rZ  r  
new_labelsr  br  by_items
new_blocksnew_blk_itemsear!  r}  itemjitemss                          rX   r  Table._get_blocks_and_items  s*    ejj,//%%g.E	H jj<%"3::.!.s!3	|
 !31 5D{+66u\7JKJ--
-6;;C|S)C#**%F%c*I! mmQCdm388<-cjj)  s!34 "  #&f"8"8JA gnn&'!5"8   ')JM!bii(	!)e!4JA%%a(!((1 "  F%I  + #H-  XXe&Led|D'9e&LMF$EfX N, , s*   ('G115G77IIH,+IIc                  ^ ^ Ub  [        U5      nUb^  T R                  (       aM  [        T R                  [         5      (       d   eT R                   H  nXC;  d  M
  UR	                  SU5        M     T R
                   H  u  pV[        TXVU5      mUU 4S jnM     UR                  b-  UR                  R                  5        H  u  pn
W" XU	5      mM     T$ )zprocess axes filtersr   c                  > TR                    H  nTR                  U5      nTR                  U5      nUc   eX:X  aQ  T	R                  (       a$  UR	                  [        T	R                  5      5      nU" XQ5      nTR                  US9U   s  $ X;   d  M  [        [        TU 5      R                  5      n[        U5      n[        T[        5      (       a  SU-
  nU" Xq5      nTR                  US9U   s  $    [        SU  S35      e)Nr  rg   zcannot find the field [z] for filtering!)_AXIS_ORDERSr  	_get_axisre  unionr-   r  r  r;   r  r  rS   r+   r   )
fieldfiltopr  axis_numberaxis_valuestakersr  r  r   s
           rX   process_filter*Table.process_axes.<locals>.process_filterj  s    !$!1!1I"%"6"6y"AK"%--	":K&222 )  ..#'::eDKK.@#AD!#K!6"wwKw8@@ -!-gc5.A.H.H!I+D1 &c955*+k/K!#F!1"wwKw8@@5 "28 !#:5'AQ!RSSrZ   )	rj   re  rS   r  insertrf  r  filterr   )r   r  r  r   r  rZ  labelsr  r  r  r  s   ``         rX   process_axesTable.process_axesY  s     7mG 4#6#6dkk40000[[#NN1a( !
 !//LDT7;CT T 0F '#,#3#3#:#:#<4$U"5 $= 
rZ   c                   Uc  [        U R                  S5      nSUS.nU R                   Vs0 s H  ofR                  UR                  _M     snUS'   U(       aJ  Uc  U R
                  =(       d    Sn[        5       R                  UUU=(       d    U R                  S9nXuS'   U$ U R                  b  U R                  US'   U$ s  snf )z:create the description of the table from the axes & valuesi'  rv   )rd   r  r  	   )r   r   r   r   )
maxro  r  rB  rA  r   r   r%  r   r   )r   r   r   r   r  r  r   r   s           rX   create_descriptionTable.create_description  s     t22E:Ll; 59II>IqGGQUUNI>-  OO0q	i''#%9)9)9 ( G
 #iL  ]]&==AiL ?s    Cc                   U R                  U5        U R                  5       (       d  g[        XX#S9nUR                  5       nUR                  b  UR                  R                  5        Hg  u  pgnU R                  XeR                  5       UR                  5       S-   S9n	XW" U	R                  XUR                  5       -
     U5      R                     nMi     [        U5      $ )zN
select coordinates (row numbers) from a table; return the
coordinates object
FrK  rg   r  )r  rE  r  select_coordsr
  r   rS  r/  r  ilocr  r-   )
r   rn   r   r   r  coordsr  r  r  r  s
             rX   rM  Table.read_coordinates  s     	e$    duH	((*'#,#3#3#:#:#<4''FJJL14D (   499Vjjl-B#CT J Q QR	 $= V}rZ   c                .   U R                  5         U R                  5       (       d  gUb  [        S5      eU R                   H  nXR                  :X  d  M  UR
                  (       d  [        SU S35      e[        U R                  R                  U5      nUR                  U R                  5        UR                  XcU U R                  U R                  U R                  S9n[!        [#        US   UR$                  5      USS9s  $    ['        SU S35      e)	zR
return a single column from the table, generally only indexables
are interesting
Fz4read_column does not currently accept a where clausezcolumn [z=] can not be extracted individually; it is not data indexabler:  rg   )rd   r  z] not found in the table)r  rE  r   r  rd   r<  r   r  rv   r  r  r  r  r   r_   r   r1   rz  r>  r   )r   rR  rn   r   r   r   r  
col_valuess           rX   rS  Table.read_column  s    	   RSS A**$"6( +3 3  DJJOOV4

499%YYDM LL!]];;	 ' 
 gjmQTT:eTT# & &)ABCCrZ   )	r   r_   r   rN  r  r  r   rf  rO  )Nr   NNNNNN)r   r   r   rG   r_   r#  r   rb   rN  zlist[IndexCol] | Nonerf  z list[tuple[AxisInt, Any]] | NonerO  zlist[DataCol] | Noner   zlist | Noner  zdict | Noner  r  r  )r  rb   r  r  )r  r  r  z tuple[DataFrame, list[Hashable]]r  )r  zitertools.chain[IndexCol])r  ztuple[int, ...])r  dict[str, Any])r  r  )r   rb   r  rb   )r   rb   r  r  r  r  r  r\   r  )r  r#  r  r  r  )r   r  r   r  r  z9list[tuple[np.ndarray, np.ndarray] | tuple[Index, Index]]r  r,  )TNNN)r  r+   r7  r,  )r  r+   r  r,  )r  r  r  r+   )r   r  r   r,  r  r  r  r  r  )rR  rb   r   r  r   r  )6r   r%  r&  r'  r(  ra  rb  r)  r  rd  r   r*  rS  r  r   r7  re  rk  ro  r  r  rv   rv  r  r  rV  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  rL  r  r  r  staticmethodr  r  r  rM  rS  r+  rM  rN  s   @rX   r  r    sT   . KKO#$F $HN  $,0;?,0$(   	
  * 9 * "  
 * - -
$B - -!%!	)!" F F % % 2 2       & & B B < <   
 
"<
3*

$$
Q	* I IX ?CT1;T	Tn CG & 5? 	B D  $=T n n 	n` A!A!A! A!F5n  	
 ! 
@ HL!+:D:  )D)D 	)D
 )D )DrZ   r  c                  B    \ rS rSrSrSr    S   S	S jjrS
S jrSrg)r  i  z
a write-once read-many table: this format DOES NOT ALLOW appending to a
table. writing is a one-time operation the data are stored in a format
that allows for searching the data on disk
r  Nc                    [        S5      e)zK
read the indices and the indexing array, calculate offset rows and return
z!WORMTable needs to implement readr  r  s        rX   r<  WORMTable.read  s     ""EFFrZ   c                    [        S5      e)z
write in a format that we can search later on (but cannot append
to): write out the indices and the values using _write_array
(e.g. a CArray) create an indexing table so that we can search
z"WORMTable needs to implement writer  r  s      rX   r   WORMTable.write
  s     ""FGGrZ   r   r  r  r  )	r   r%  r&  r'  r(  r  r<  r   r+  r   rZ   rX   r  r    s>     J  
G 	
G
 
GHrZ   r  c                      \ rS rSrSrSr            S
         SS jjrSSS jjr          SS jrSSS jjr	S	r
g)r  i  (support the new appendable table formats
appendableNc           	     H   U(       d7  U R                   (       a&  U R                  R                  U R                  S5        U R	                  UUUUUUS9nUR
                   H  nUR                  5         M     UR                   (       dN  UR                  UUUU	S9nUR                  5         UUS'   UR                  R                  " UR                  40 UD6  UR                  UR                  l
        UR
                   H  nUR                  X5        M     UR                  XS9  g )Nrv   )r  r  r7  r   r   r   )r   r   r   r  rp  )r   )r  r   r  r   r  r  r  r  r  create_tabler  r  r  
write_data)r   r  r  r   r   r   r   r   r   r  r   r   r   rp  rv   r   optionss                    rX   r   AppendableTable.write  s
     $..LL$$TZZ9 !!%% " 
 A  ..#%)	 / G OO%0GM" MM&&u{{>g> !:: Au-  	2rZ   c                j   U R                   R                  nU R                  n/ nU(       au  U R                   He  n[	        UR
                  5      R                  SS9n[        U[        R                  5      (       d  MF  UR                  UR                  SSS95        Mg     [        U5      (       a&  US   nUSS  H  nXx-  nM	     UR                  5       nOSnU R                   Vs/ s H  ofR                  PM     n	n[        U	5      n
U
S:X  d   U
5       eU R                   Vs/ s H  ofR!                  5       PM     nnU Vs/ s HS  oR#                  [        R$                  " [        R&                  " UR(                  5      UR(                  S-
  5      5      PMU     nn/ n[+        U5       HG  u  pU4U R                   X:U-         R,                  -   nUR                  UR/                  U5      5        MI     Uc  Sn[        R0                  " [3        X5      U R                   S	9nXA-  S-   n[5        U5       Ha  nX-  n[3        US-   U-  U5      nUU:  a    gU R7                  UU	 Vs/ s H  ofUU PM	     snUb  UUU OSU Vs/ s H  oUU PM	     snS
9  Mc     gs  snf s  snf s  snf s  snf s  snf )zP
we form the data into a 2-d including indexes,values,mask write chunk-by-chunk
r   r  u1Fr8  rg   Nr.  r4  )indexesrG  r  )rv  r  ro  rO  r4   r  r  rS   rT   ru  r   rA  rm   r>  rN  r  r  	transposerollaranger  r  r  reshaper  r/  r  write_data_chunk)r   r   r   r  rC  masksr   rG  r  r-  nindexesr  r  bvaluesr  	new_shaperowschunksstart_iend_is                       rX   r(  AppendableTable.write_dataT  sl    

  ## %% AFF|''Q'/dBJJ//LLT!>? & u::8D12Yx ::<DD '+oo6o99o6w<1}&h&} *.)9)9:)9A++-)9:OUVv!++bggbii&7!DEvVf%DA4::eqL.A#B#H#HHINN199Y/0 &
 IxxI-TZZ@#a'vAmGQ)+U3E%!!3:;7a75)7;,0,<T'%($29:'Q'%(':	 "  ' 7 ;V( <:s   'J$J!AJ&'J+J0c                   U H*  n[         R                  " UR                  5      (       a  M*    g   US   R                  S   nU[        U5      :w  a  [         R                  " X`R
                  S9nU R
                  R                  n[        U5      n[        U5       H  u  pXXy   '   M     [        U5       H  u  pXQXyU-      '   M     Ub<  UR                  5       R                  [        SS9) nUR                  5       (       d  X   n[        U5      (       a6  U R                  R                  U5        U R                  R                  5         gg)z
Parameters
----------
rows : an empty memory space where we are putting the chunk
indexes : an array of the indexes
mask : an array of the masks
values : an array of the values
Nr   r4  Fr8  )rT   r  r  rm   r  rv  r  r  r>  rA  r,  r  rv   r   r0  )r   r7  r-  rG  r  r  rC  r  r4  r  r  r  s               rX   r2   AppendableTable.write_data_chunk  s     A77177##  
  #CI88E4D

  w<  (FA N ) f%DA()8|$% & $$T$66A5577wt99JJd#JJ rZ   c                   Ub  [        U5      (       d|  Uc5  Uc2  U R                  nU R                  R                  U R                  SS9  U$ Uc  U R                  nU R
                  R                  X#S9nU R
                  R                  5         U$ U R                  5       (       d  g U R
                  n[        XX#S9nUR                  5       n[        USS9R                  5       n[        U5      n	U	(       a  UR                  5       n
[        XS:     R                  5      n[        U5      (       d  S/nUS   U	:w  a  UR!                  U	5        US   S:w  a  UR#                  SS5        UR%                  5       n['        U5       HP  nUR)                  [+        X5      5      nUR                  XR                  S      XR                  S      S-   S9  UnMR     U R
                  R                  5         U	$ )	NTru  r  Fr8  rg   r   r5  )rm   rC  r   r  r   rv   remove_rowsr0  rE  r  r  r1   sort_valuesdiffrj   r   r   r	  rg  reversedr  r  )r   rn   r   r   rC  rv   r  r  sorted_serieslnrA  r   pgr   r7  s                  rX   r|  AppendableTable.delete  s   =E

}

((t(D L	 <::D

..U.F

  "L    

dB	((* vE2>>@ %%'D$ax.../F v;; bzRb! ayA~a# Bf%$))%,7!!zz!}-DB4H14L "   & JJ 	rZ   r   )NFNNNNNNFNNT)
r   r,  r   r  r   r,  rp  r,  r  r  r  )r   r  r   r,  r  r  )
r7  r  r-  list[np.ndarray]rG  znpt.NDArray[np.bool_] | Noner  rG  r  r  r  r  )r   r%  r&  r'  r(  r  r   r(  r2  r|  r+  r   rZ   rX   r  r    s    2J  $ 93 	93 93 93 93 
93v9v** "* +	*
 !* 
*X8 8rZ   r  c                  x    \ rS rSr% SrSrSrSr\r	S\
S'   \SS j5       r\SS	 j5       r    S   SS jjrSrg
)r  i  r$  r  r  ri  rc  rd  c                :    U R                   S   R                  S:H  $ )Nr   rg   )rN  rZ  r   s    rX   r  "AppendableFrameTable.is_transposed  s    q!&&!++rZ   c                ,    U(       a  UR                   nU$ )zthese are written transposed)r  r  s      rX   r  AppendableFrameTable.get_object  s     %%C
rZ   Nc           	        U R                  U5        U R                  5       (       d  g U R                  XUS9n[        U R                  5      (       a,  U R
                  R                  U R                  S   S   0 5      O0 n[        U R                  5       VVs/ s H  u  pxXR                  S   L d  M  UPM     n	nn[        U	5      S:X  d   eU	S   n
XZ   S   n/ n[        U R                  5       GH5  u  p}XR                  ;  a  M  XW   u  pUR                  S5      S:w  a  [        U5      nO[        R                  " U5      nUR                  S5      nUb  UR                  USS9  U R                  (       a  UnUn[        U[!        US	S 5      S
9nO#UR"                  n[        U[!        US	S 5      S
9nUnUR$                  S:X  a?  ['        U[(        R*                  5      (       a   UR-                  SUR.                  S   45      n['        U[(        R*                  5      (       a  [1        UR"                  UUSS9nO8['        U[        5      (       a  [1        UUUS9nO[0        R2                  " U/UUS9n[5        5       (       a  UR6                  R8                  S:X  dI  UR:                  UR6                  :H  R=                  5       (       d   UR:                  UR6                  45       e[5        5       (       a   [?        USS9(       a  URA                  S5      nURC                  U5        GM8     [        U5      S:X  a  US   nO
[E        USS9n[G        XX4S9nU RI                  UUUS9nU$ s  snnf )NrK  r   rg   r   r.   r  Tinplacerd   rc   Fr6  r7  r9  r  r(  r  )r  r   )%r  rE  r  rm   rf  r  r   r  r  rN  rO  r-   r.   from_tuples	set_namesr  r  r  r  rS   rT   ru  r1  r  r+   _from_arraysr   rv  r  dtypesr  r   rA  r   r3   r  r  )r   rn   r   r   r   r  r  r  r:  indsindr   framesr   
index_valsr  r  r  r  index_cols_r=  r  s                          rX   r<  AppendableFrameTable.read	  s    	e$   uE 4&&'' IIMM$--a03R8 	  )3P3ear__Q=O7O3P4yA~~1gAdii(DA((("()J xx</Z(!--j9HHW%E ud3!! e'%*FG u75&$+GH {{aJvrzz$B$BFLLO(<=&"**--vxxf5QFE**vuFC ++VHe6R.00V\\5F5F#5M		V\\16688S299fll:SS8)++1 YY67MM"W )Z v;!BQ'BduH	rYH	y Qs   M&3M&r   r  r  r  r  )r   r%  r&  r'  r(  ra  r  r  r+   rd  r)  r*  r  rL  r  r<  r+  r   rZ   rX   r  r    su    2K#JD)2H&2, ,    R 	R
 R RrZ   r  c                     ^  \ rS rSrSrSrSrSr\r	\
SS j5       r\SS j5       rSSU 4S jjjr    S     SU 4S	 jjjrS
rU =r$ )r  i^  r$  r  r  ri  c                    gr  r   r   s    rX   r  #AppendableSeriesTable.is_transposedf  r  rZ   c                    U$ r\   r   r  s      rX   r   AppendableSeriesTable.get_objectj  s    
rZ   c                   > [        U[        5      (       d&  UR                  =(       d    SnUR                  U5      n[        TU ]  " SXR                  R                  5       S.UD6  g)+we are going to write this as a frame tabler  r  r   Nr   )rS   r+   rd   to_framer  r   r   r  )r   r  r   r   rd   r  s        rX   r   AppendableSeriesTable.writeo  sM    #y))88'xD,,t$CK#KK,>,>,@KFKrZ   c                  > U R                   nUbT  U(       aM  [        U R                  [        5      (       d   eU R                   H  nXb;  d  M
  UR	                  SU5        M     [
        TU ]  XX4S9nU(       a  UR                  U R                  SS9  UR                  S S 2S4   nUR                  S:X  a  S Ul	        U$ )Nr   rY  TrN  r  )
re  rS   r  rj   r	  r  r<  	set_indexr  rd   )	r   rn   r   r   r   re  r  rW   r  s	           rX   r<  AppendableSeriesTable.readv  s     ,,>dkk40000[[#NN1a( ! GLuULNKKTK2FF1a4L 66XAFrZ   r   r  r  r\   r  r  r,  )r   r%  r&  r'  r(  ra  r  r  r1   rd  r*  r  rL  r  r   r<  r+  rM  rN  s   @rX   r  r  ^  s    2 K$JDH   L L   	
  
 rZ   r  c                  8   ^  \ rS rSrSrSrSrSU 4S jjrSrU =r	$ )r  i  r$  r  r  c                2  > UR                   =(       d    SnU R                  U5      u  o@l        [        U R                  [        5      (       d   e[	        U R                  5      nUR                  U5        [        U5      Ul        [        TU ]$  " SSU0UD6  g)ra  r  r  Nr   )
rd   rk  r  rS   rj   r   r-   r   r  r   )r   r  r   rd   newobjr  r  s         rX   r    AppendableMultiSeriesTable.write  sv    xx#8"66s;$++t,,,,DKK Dt+&+F+rZ   r  r  )
r   r%  r&  r'  r(  ra  r  r   r+  rM  rN  s   @rX   r  r    s    2 K)J, ,rZ   r  c                  |    \ rS rSr% SrSrSrSr\r	S\
S'   \SS j5       r\S	 5       rSS
 jr\S 5       rSS jrSrg)r  i  z:a table that read/writes the generic pytables table formatr  r  ri  zlist[Hashable]r  c                    U R                   $ r\   )ra  r   s    rX   r  GenericTable.pandas_type  s    rZ   c                V    [        U R                  SS 5      =(       d    U R                  $ rt  ru  r   s    rX   r  GenericTable.storable  s    tzz7D1?TZZ?rZ   c                r   / U l         SU l        / U l        U R                   Vs/ s H  oR                  (       d  M  UPM     snU l        U R                   Vs/ s H  oR                  (       a  M  UPM     snU l        U R                   Vs/ s H  oR                  PM     snU l        gs  snf s  snf s  snf )r  N)	rf  r   r  r  r;  rN  rO  rd   r   r  s     rX   r  GenericTable.get_attrs  s     &*ooKo9J9J1oK'+P!>O>OAP-1-=-=>-=VV-=> LP>s   B*B*B/0B/B4c                   U R                   nU R                  S5      nUb  SOSn[        SSU R                  X2S9nU/n[	        UR
                  5       Hj  u  pg[        U[        5      (       d   e[        X5      nU R                  U5      nUb  SOSn[        UUU/UU R                  UUS9n	UR                  U	5        Ml     U$ )z0create the indexables from the table descriptionr   Nr  r   )rd   rZ  rv   r   rD  )rd   rC  r  rA  rv   r   rD  )r  r  r  rv   r  _v_namesrS   rb   r  r^  r   )
r   r  r  r   r  r  r  r  r  r  s
             rX   r  GenericTable.indexables  s     
 (^z#q


	 IR{ajj)DAa%%%%1=D##A&B!#:TD(sjjB r" *" rZ   c                    [        S5      e)Nz cannot write on an generic tabler  )r   r   s     rX   r   GenericTable.write  s    !"DEErZ   )r   rN  r  r   rf  rO  Nr  r  )r   r%  r&  r'  r(  ra  r  r  r+   rd  r)  r*  r  r  r  r   r  r   r+  r   rZ   rX   r  r    sg    DK JDH    @ @?    FFrZ   r  c                     ^  \ rS rSrSrSr\rSr\	R                  " S5      r\S
S j5       rSSU 4S jjjr    S   SU 4S jjjrS	rU =r$ )r  i  za frame with a multi-indexr  ri  z^level_\d+$c                    g)Nappendable_multir   r   s    rX   rS  *AppendableMultiFrameTable.table_type_short  s    !rZ   c                >  > Uc  / nOUSL a  UR                   R                  5       nU R                  U5      u  ol        [	        U R                  [
        5      (       d   eU R                   H  nXB;  d  M
  UR                  SU5        M     [        TU ]   " SXS.UD6  g )NTr   rb  r   )	r   r  rk  r  rS   rj   r	  r  r   )r   r  r   r   r  r  s        rX   r   AppendableMultiFrameTable.write  s    LT!;;--/L33C8[$++t,,,,A$##Aq)  	C#CFCrZ   c                0  > [         TU ]  XX4S9nUR                  U R                  5      nUR                  R                  UR                  R                   Vs/ s H&  o`R                  R                  U5      (       a  S OUPM(     sn5      Ul        U$ s  snf )NrY  )	r  r<  rf  r  r   rQ  r  
_re_levelssearch)r   rn   r   r   r   r=  rd   r  s          rX   r<  AppendableMultiFrameTable.read  s     W\e\O\\$++& 88%%HJW__++D11Tt;W
 	 Xs   -Brl  r  r\   r  r  r  )r   r%  r&  r'  r(  r  r+   rd  r  recompiler  r*  rS  r   r<  r+  rM  rN  s   @rX   r  r    sm    $(JHDN+J" "
D 
D   	
  rZ   r  c                   U R                  U5      n[        U5      nUb  [        U5      nUb  UR                  U5      (       a  UR                  U5      (       a  U $ [        UR                  5       5      nUb'  [        UR                  5       5      R	                  USS9nUR                  U5      (       d6  [        S S 5      /U R                  -  nX%U'   U R                  [        U5         n U $ )NF)sort)	r  r;   equalsuniquer  slicer  r  rk   )r  rZ  r  r`  r:  slicers         rX   r  r    s     
t	B&!F U#u--6==3D3D
&--/*Felln-::6:N==',T4'8&9CHH&DtggeFm$JrZ   c                2    [         R                  " U 5      nU$ )z+for a tz-aware type, return an encoded zone)r   get_timezone)r>  zones     rX   r  r  )  s    !!"%DKrZ   c                    g r\   r   r  r>  r1  s      rX   rz  rz  /  s     rZ   c                    g r\   r   r  s      rX   rz  rz  6  s    rZ   c                   [        U [        5      (       a.  U R                  b  U R                  U:X  d   eU R                  b  U $ Ubj  [        U [        5      (       a  U R                  nOSnU R	                  5       n [        U5      n[        XS9n U R                  S5      R                  U5      n U $ U(       a  [        R                  " U SS9n U $ )z
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
Nrc   r  M8[ns]r4  )
rS   r,   r>  rd   r>  rY   r  r  rT   r;  )r  r>  r1  rd   s       rX   rz  rz  ;  s     &-(( yy FIIO3399 M	~fm,,;;DD\\^FR v1##E*55b9 M 
F(3 MrZ   c                   [        U [        5      (       d   eUR                  n[        U5      u  pV[	        U5      n[
        R                  U5      n[        R                  " UR                  S5      (       d4  [        UR                  5      (       d  [        UR                  5      (       a%  [        U UUU[        USS 5      [        USS 5      US9$ [        U[        5      (       a  [        S5      e[        R                   " USS9n	["        R$                  " U5      n
U	S:X  ac  ["        R$                  " U
 Vs/ s H  oR'                  5       PM     sn["        R(                  S	9n[        XS[+        5       R-                  5       US
9$ U	S:X  aF  [/        XU5      nUR                  R0                  n[        U US[+        5       R3                  U5      US
9$ U	S;   a  [        XXxUS9$ [        U["        R4                  5      (       a  UR                  [6        :X  d   eUS:X  d   U5       e[+        5       R9                  5       n[        XXxUS
9$ s  snf )Niur=  r>  )r  r  rA  r=  r>  r?  zMultiIndex not supported here!Fr  r   r4  )r?  r  )integerfloating)r  r  rA  r?  r  )rS   rb   rd   r  r  rP  r  r   ry  rv  r%   r!   r:  r  r.   r   r  rT   r;  	toordinalint32r   	Time32Col_convert_string_arrayrH  r  ru  r  r  )rd   r   r_   r   r?  rF  r  r  r  r!  r  r  rH  s                rX   r  r  b  s   dC    J 5U;I*%D%%i0D 	T**u{{++%%
 -udD)!
 	
 %$$899OOE%8M ZZFJJv>v!v>bhhO	VWY%8%8%:z
 	
 
(	")&FC	??++I)!
 	
 
1	1J
 	
 )RZZ00Y__5NNNx%%y##%
KK/  ?s   5Ic           	        UR                  S5      (       a0  US:X  a  [        U 5      nU$ [        U R                  U5      5      n U$ US:X  a  [        U 5      nU$ US:X  aA   [        R
                  " U  Vs/ s H  n[        R                  " U5      PM     sn[        S9nU$ US;   a  [        R
                  " U 5      nU$ US;   a  [        U S X#S9nU$ US:X  a  [        R
                  " U S	   5      nU$ [        S
U 35      es  snf ! [         aH    [        R
                  " U  Vs/ s H  n[        R                  " U5      PM     Os  snf sn[        S9n U$ f = f)Nr/  r2  r   r4  )r  floatr,  r  r:  r  r   zunrecognized index type )r  r,   r  r2   rT   r;  r   r<  r  r   r=  rE  )r  r  r_   r   r   r  s         rX   r	  r	    sd    |$$<!$'E( L% "$))D/2E$ L# 
	t$  L 
	TJJTBT 0 0 3TB&QE L 
-	-

4  L 
(	'$
 L	 
	

47# L 3D6:;;  C 	TJJtDt! 2 21 5tDFSE L	Ts0   !D 5 D
D D E$ E
EEc                   UR                   [        :w  a  U$ [        [        R                  U5      nUR                   R
                  n[        R                  " USS9n	U	S:X  a  [        S5      eU	S:X  a  [        S5      eU	S:X  d  US:X  d  U$ [        U5      n
UR                  5       nXKU
'   [        R                  " USS9n	U	S:w  ah  [        UR                  S	   5       HL  nX   n[        R                  " USS9n	U	S:w  d  M$  [        U5      U:  a  X|   OS
U 3n[        SU SU	 S35      e   [        XU5      R                  UR                  5      nUR                   n[#        U[$        5      (       a;  ['        UR)                  U 5      =(       d    UR)                  S5      =(       d    S	5      n[+        U=(       d    S	U5      nUb  UR-                  U5      nUb  UU:  a  UnUR/                  SU 3SS9nU$ )NFr  r   z+[date] is not implemented as a table columnr  z>too many timezones in this block, create separate data columnsr  r  r   zNo.zCannot serialize the column [z2]
because its data contents are not [string] but [z] object dtyper  z|Sr8  )rv  r  r   rT   ru  rd   r   r  r   r4   r  r  r  rm   r  r1  rH  rS   r  r  r   r  r  rA  )rd   r5  r  r   r   r_   r   r   r  r!  rG  r  r  r  error_column_labelr  rH  ecis                     rX   r  r    s    }}2::w'G##JOOGE:MEFF
" L
 	
 X%x)?=D<<>DJ OOD7M  tzz!}%A'COOC>M(36w<!3CWZ3qc"34F3G H%n6  & +46BJJ4::VN&&H ,%%<++D1T\5E5Eh5OTSTU<$1h/H ''1?sX~H#**Rz?*GNrZ   c                p   [        U 5      (       aT  [        U R                  5       SS9R                  R	                  X5      R
                  R                  U R                  5      n [        U R                  5       5      n[        S[        R                  " U5      5      n[        R                  " U SU 3S9n U $ )z
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]
Fr8  rg   Sr4  )rm   r1   r>  rb   encoderC  r1  r  r    r  
libwritersmax_len_string_arrayrT   r;  )r  r_   r   ensuredrH  s        rX   r  r    s      4yy4::<e,S)WWWTZZ( 	 DJJL)G1j55g>?H::dAhZ.1DKrZ   c                   U R                   n[        R                  " U R                  5       [        S9n [        U 5      (       a  [        R                  " [        U 5      5      nSU 3n[        U S   [        5      (       a,  [        U SS9R                  R                  X#S9R                  n O"U R                  USS9R                  [        SS9n Uc  Sn[        R                   " X5        U R#                  U5      $ )z
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.
r4  Ur   Fr8  )r   r  )r  rT   r;  r>  r  rm   r  r  r    rS   r  r1   rb   rV   rC  rA  !string_array_replace_from_nan_repr1  )r  r   r_   r   r  rH  rv  s          rX   rE  rE  '  s    & JJE::djjl&1D
4yy22=3FGH:d1gu%%$U+//66x6OWWD;;u5;188e8LD00?<<rZ   c                    [        U[        5      (       d   [        U5      5       e[        U5      (       a  [	        XU5      nU" U 5      n U $ r\   )rS   rb   r   _need_convert_get_converter)r  r{  r_   r   convs        rX   rx  rx  M  sC    h$$4d8n4$Xh&9fMrZ   c                h   ^ ^^ T S:X  a  S $ ST ;   a  U 4S j$ T S:X  a  UU4S j$ [        ST  35      e)Nr/  c                ,    [         R                  " U SS9$ )Nr  r4  rT   r;  )rj  s    rX   r    _get_converter.<locals>.<lambda>W  s    AX6rZ   c                .   > [         R                  " U TS9$ )Nr4  r  )rj  r  s    rX   r   r  Y  s    AT2rZ   r  c                   > [        U S TTS9$ )Nr:  )rE  )rj  r_   r   s    rX   r   r  [  s    0thv
rZ   zinvalid kind )r   )r  r_   r   s   ```rX   r  r  U  sE    |66		22		
 	
 =/00rZ   c                    U S;   d  SU ;   a  gg)N)r/  r  r/  TFr   r  s    rX   r  r  b  s    ''<4+?rZ   c                   [        U[        5      (       d  [        U5      S:  a  [        S5      eUS   S:X  aH  US   S::  a?  US   S:X  a6  [        R
                  " SU 5      nU(       a  UR                  5       S   nSU 3n U $ )	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.r   rg   rh  ri  zvalues_block_(\d+)values_)rS   rb   rm   r   r  r  r   )rd   rj  r  grps       rX   r  r  h  s{     '33w<!#3QRRqzQ71:+
aII+T2((*Q-CSE?DKrZ   c                   [        U 5      n U R                  S5      (       a  SnU$ U R                  S5      (       a  SnU$ U R                  S5      (       a  SnU$ U R                  S5      (       a  SnU$ U R                  S5      (       a  U nU$ U R                  S5      (       a  S	nU$ U R                  S
5      (       a  S
nU$ U R                  S5      (       a  SnU$ U R                  S5      (       a  SnU$ U S:X  a  SnU$ [        SU  S35      e)z9
Find the "kind" string describing the given dtype name.
)r  r  r  r  r  )r  r  r  r/  	timedeltar2  r,  r  r  r  zcannot interpret dtype of [rW  )rY   r  r   )	dtype_strr  s     rX   r  r    sQ     	*I/00. K- 
		g	&	&* K) 
		i	(	(& K% 
		o	.	." K! 
		l	+	+ K 
		k	*	* K 
		f	%	% K 
		j	)	) K 
		h	'	' K 
h	 K 6ykCDDrZ   c                   [        U [        5      (       a  U R                  n [        U R                  [        5      (       a  SU R                  R
                   S3nOU R                  R                  nU R                  R                  S;   a&  [        R                  " U R                  S5      5      n O![        U [        5      (       a  U R                  n [        R                  " U 5      n X4$ )zB
Convert the passed data into a storable form and a dtype string.
r  rW  mMro  )rS   r5   r   rv  r'   r  rd   r  rT   r;  r  r/   r  )r  r  s     rX   r  r    s     $$$zz$**o.."4::??"315
ZZ__
zz$zz$))D/* 
D+	&	&yy::dDrZ   c                  L    \ rS rSrSr   S	       S
S jjrS rS rS rSr	g)r  i  z
Carries out a selection operation on a tables.Table object.

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

Nc                   Xl         X l        X0l        X@l        S U l        S U l        S U l        S U l        [        U5      (       Ga\  [        [        5         [        R                  " USS9nUS;   Ga(  [        R                  " U5      nUR                  [        R                   :X  aT  U R                  U R                  pCUc  SnUc  U R                   R"                  n[        R$                  " X45      U   U l        O['        UR                  R(                  [        R*                  5      (       am  U R                  b!  X R                  :  R-                  5       (       d.  U R                  b,  X R                  :  R-                  5       (       a  [        S5      eX l        S S S 5        U R                  cL  U R/                  U5      U l        U R                  b(  U R                  R1                  5       u  U l        U l        g g g ! , (       d  f       Nh= f)NFr  )r  booleanr   z3where must have index locations >= start and < stop)rv   rn   r   r   	conditionr
  termsr`  r#   r   r   r   r  rT   r;  rv  bool_rC  r0  
issubclassr   r  r@  generateevaluate)r   rv   rn   r   r   inferreds         rX   r   Selection.__init__  s    


	
*%??5?55JJu-E{{bhh.&*jj$))t =$%E<#'::#3#3D+-99U+A%+H(#EKK$4$4bjjAA JJ2

8J7O7O7Q7Q II1u		7I6N6N6P6P", U#  ,1(% &( #u-DJ zz%.2jj.A.A.C+ &	 $) &%s   EG<<
H
c                   Uc  gU R                   R                  5       n [        XU R                   R                  S9$ ! [         aB  nSR                  UR                  5       5      n[        SU SU S35      n[        U5      UeSnAff = f)z'where can be a : dict,list,tuple,stringN)r  r_   rS  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
                )	rv   r  r8   r_   	NameErrorrV  r  r   r   )r   rn   r  r}  qkeysr'  s         rX   r  Selection.generate  s    =JJ!!#	+djj>Q>QRR 	+ HHQVVX&E..3W 5C DI' JC S/s*	+s   > 
B
=BB
c                   U R                   bQ  U R                  R                  R                  U R                   R                  5       U R                  U R
                  S9$ U R                  b/  U R                  R                  R                  U R                  5      $ U R                  R                  R                  U R                  U R
                  S9$ )
generate the selection
r  )	r  rv   
read_wherer   r   r   r`  rM  r<  r   s    rX   r   Selection.select  s     >>%::##..%%'tzz		 /   )::##44T5E5EFFzz$$4::DII$FFrZ   c                   U R                   U R                  p!U R                  R                  nUc  SnO
US:  a  X-  nUc  UnO
US:  a  X#-  nU R                  b=  U R                  R                  R                  U R                  R                  5       XSS9$ U R                  b  U R                  $ [        R                  " X5      $ )r  r   T)r   r   r  )
r   r   rv   rC  r  get_where_listr   r`  rT   r0  )r   r   r   rC  s       rX   r  Selection.select_coords  s     jj$))t

  =EQYNE<DAXMD>>%::##22%%'ud 3   )###yy%%rZ   )r  r`  r
  r   r   rv   r  rn   r  )rv   r  r   r  r   r  r  r  )
r   r%  r&  r'  r(  r   r  r   r  r+  r   rZ   rX   r  r    sS    	  +D+D 	+D
 +D 
+DZ+.
G&rZ   r  )r_   r#  r  rb   )ri   r  )r   NNFNTNNNNr   rQ   )r   FilePath | HDFStorer   rb   r   r  r   rb   r   r  r   r#  r   r,  r   r#  r   r,  r   r  r   r"  r   r   r   rb   r_   rb   r  r  )	Nr   r   NNNNFN)r   r  r   rb   r   rb   rn   zstr | list | Noner   r  r   r  r   zlist[str] | Noner   r,  r   r  )r   rG   r   rG   r  r,  r\   )r  r+   rZ  rJ   r  r-   r  r+   )r>  r   r  str | tzinfor  )r  np.ndarray | Indexr>  r  r1  r,  r  r,   )r  r  r>  r  r1  r,  r  r  )r  r  r>  zstr | tzinfo | Noner1  r,  r  znp.ndarray | DatetimeIndex)
rd   rb   r   r-   r_   rb   r   rb   r  r:  )r  rb   r_   rb   r   rb   r  r  )rd   rb   r5  rI   r   r  )r  r  r_   rb   r   rb   r  r  )r  r  r{  rb   r_   rb   r   rb   )r  rb   r_   rb   r   rb   )r  rb   r  r,  )rd   rb   rj  zSequence[int]r  rb   )r  rb   r  rb   )r  rI   )r(  
__future__r   
contextlibr   r  r  r   r   ra  r   r  textwrapr   typingr   r	   r
   r   r   r   r   r  numpyrT   pandas._configr   r   r   r   pandas._libsr   r   r  pandas._libs.libr   pandas._libs.tslibsr   pandas.compat._optionalr   pandas.compat.pickle_compatr   pandas.errorsr   r   r   r   r   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*   r  r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   pandas.core.arraysr5   r6   r7   pandas.core.commoncorecommonrz   pandas.core.computation.pytablesr8   r9   pandas.core.constructionr:   pandas.core.indexes.apir;   pandas.core.internalsr<   r=   pandas.io.commonr>   pandas.io.formats.printingr?   r@   collections.abcrA   rB   rC   typesrD   r   rE   rF   rG   pandas._typingrH   rI   rJ   rK   rL   rM   rN   rO   rP   r}  r]   rY   r`   re   rl   rq   rr   r)  rs   rt   r  r  ry   rz   config_prefixregister_optionis_boolis_one_of_factoryr   r   r   r   r   r   r   rF  r:  r  r  rP  r^  r`  r  r  r.  r  r  r  r  r  r  r  r  r  r  r  rz  r  r	  r  r  rE  rx  r  r  r  r  r  r  r   rZ   rX   <module>r     s   #    	 	       - ) > 4  3 4   8   
 !   3 0
 ,
  
 $ 	 	 	 ,   	 :* U !  
  gGgN 	
E 
E  (#
>5*W
**+CD	 $ 
$) !4  04595$5	5 5 	5
 5 5 5 5 5 .5 5 35 5 5  
!5t 	# $ X$X X 	X
 X X X X X XvZ Zz,m m`e> e>P	h :Y9h Y9x$w $63. 3i? i?XbB5 bBJ #,  #F`; `;F" 
dDE dDNH H<`e `Fe? eP.0 .b,!6 ,$@F' @FF( 4 (X 9=	!+04 
AF$0:> 
 
 

 IN$$$7$AE$$N=L@:F
FF FR>#
#),#69##L
12B2r& r&w^ $#s   AN//
N>