Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 4726f970c4b56b9a0ebb9a03a0b6522e > files > 170

python-tables-doc-3.0.0-4.mga4.noarch.rpm




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Supported data types in PyTables &mdash; PyTables 3.0.0 documentation</title>
    
    <link rel="stylesheet" href="../_static/cloud.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '3.0.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/jquery.cookie.js"></script>
    <script type="text/javascript" src="../_static/toggle_sections.js"></script>
    <script type="text/javascript" src="../_static/toggle_sidebar.js"></script>
    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="top" title="PyTables 3.0.0 documentation" href="../index.html" />
    <link rel="up" title="PyTables User’s Guide" href="index.html" />
    <link rel="next" title="Condition Syntax" href="condition_syntax.html" />
    <link rel="prev" title="filenode - simulating a filesystem with PyTables" href="filenode.html" /> 
  </head>
  <body>
    <div class="relbar-top">
        
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="../np-modindex.html" title="Python Module Index"
             >modules</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="condition_syntax.html" title="Condition Syntax"
             accesskey="N">next</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="filenode.html" title="filenode - simulating a filesystem with PyTables"
             accesskey="P">previous</a> &nbsp; &nbsp;</li>
    <li><a href="../index.html">PyTables 3.0.0 documentation</a> &raquo;</li>

          <li><a href="index.html" accesskey="U">PyTables User&#8217;s Guide</a> &raquo;</li> 
      </ul>
    </div>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="supported-data-types-in-pytables">
<span id="datatypes"></span><h1>Supported data types in PyTables<a class="headerlink" href="#supported-data-types-in-pytables" title="Permalink to this headline">¶</a></h1>
<p>All PyTables datasets can handle the complete set of data types supported by
the NumPy (see <a class="reference internal" href="bibliography.html#numpy"><em>[NUMPY]</em></a>) package in Python.
The data types for table fields can be set via instances of the Col class and
its descendants (see <a class="reference internal" href="libref/declarative_classes.html#colclassdescr"><em>The Col class and its descendants</em></a>), while the data type of array
elements can be set through the use of the Atom class and its descendants
(see <a class="reference internal" href="libref/declarative_classes.html#atomclassdescr"><em>The Atom class and its descendants</em></a>).</p>
<p>PyTables uses ordinary strings to represent its <em>types</em>, with most of them
matching the names of NumPy scalar types. Usually, a PyTables type consists
of two parts: a <em>kind</em> and a <em>precision</em> in bits.
The precision may be omitted in types with just one supported precision (like
bool) or with a non-fixed size (like string).</p>
<p>There are eight kinds of types supported by PyTables:</p>
<ul class="simple">
<li>bool: Boolean (true/false) types.
Supported precisions: 8 (default) bits.</li>
<li>int: Signed integer types.
Supported precisions: 8, 16, 32 (default) and 64 bits.</li>
<li>uint: Unsigned integer types.
Supported precisions: 8, 16, 32 (default) and 64 bits.</li>
<li>float: Floating point types.
Supported precisions: 16, 32, 64 (default) bits and extended precision
floating point (see
<a class="reference internal" href="#floating-point-note"><em>note on floating point types</em></a>).</li>
<li>complex: Complex number types.
Supported precisions: 64 (32+32), 128 (64+64, default) bits and extended
precision complex (see
<a class="reference internal" href="#floating-point-note"><em>note on floating point types</em></a>).</li>
<li>string: Raw string types.
Supported precisions: 8-bit positive multiples.</li>
<li>time: Data/time types.
Supported precisions: 32 and 64 (default) bits.</li>
<li>enum: Enumerated types.
Precision depends on base type.</li>
</ul>
<div class="admonition note" id="floating-point-note">
<p class="first admonition-title">Note</p>
<p>Floating point types.</p>
<p>The half precision floating point data type (float16) and extended
precision ones (fload96, float128, complex192, complex256) are only
available if <a class="reference external" href="http://www.numpy.org">numpy</a> supports them on the host platform.</p>
<p class="last">Also, in order to use the half precision floating point type (float16)
it is required <a class="reference external" href="http://www.numpy.org">numpy</a> &gt;= 1.6.0.</p>
</div>
<p>The time and enum kinds area little bit special, since they represent HDF5
types which have no direct Python counterpart, though atoms of these kinds
have a more-or-less equivalent NumPy data type.</p>
<p>There are two types of time: 4-byte signed integer (time32) and 8-byte double
precision floating point (time64). Both of them reflect the number of seconds
since the Unix epoch, i.e. Jan 1 00:00:00 UTC 1970. They are stored in memory
as NumPy&#8217;s int32 and float64, respectively, and in the HDF5 file using the
H5T_TIME class. Integer times are stored on disk as such, while floating
point times are split into two signed integer values representing seconds and
microseconds (beware: smaller decimals will be lost!).</p>
<p>PyTables also supports HDF5 H5T_ENUM <em>enumerations</em> (restricted sets of
unique name and unique value pairs). The NumPy representation of an
enumerated value (an Enum, see <a class="reference internal" href="libref/helper_classes.html#enumclassdescr"><em>The Enum class</em></a>) depends on the concrete
<em>base type</em> used to store the enumeration in the HDF5 file.
Currently, only scalar integer values (both signed and unsigned) are
supported in enumerations. This restriction may be lifted when HDF5 supports
other kinds on enumerated values.</p>
<p>Here you have a quick reference to the complete set of supported data types:</p>
<table border="1" class="docutils">
<caption><strong>Data types supported for array elements and tables columns in
         PyTables.</strong></caption>
<colgroup>
<col width="18%" />
<col width="26%" />
<col width="22%" />
<col width="15%" />
<col width="18%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Type Code</th>
<th class="head">Description</th>
<th class="head">C Type</th>
<th class="head">Size (in bytes)</th>
<th class="head">Python Counterpart</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>bool</td>
<td>boolean</td>
<td>unsigned char</td>
<td>1</td>
<td>bool</td>
</tr>
<tr class="row-odd"><td>int8</td>
<td>8-bit integer</td>
<td>signed char</td>
<td>1</td>
<td>int</td>
</tr>
<tr class="row-even"><td>uint8</td>
<td>8-bit unsigned integer</td>
<td>unsigned char</td>
<td>1</td>
<td>int</td>
</tr>
<tr class="row-odd"><td>int16</td>
<td>16-bit integer</td>
<td>short</td>
<td>2</td>
<td>int</td>
</tr>
<tr class="row-even"><td>uint16</td>
<td>16-bit unsigned integer</td>
<td>unsigned short</td>
<td>2</td>
<td>int</td>
</tr>
<tr class="row-odd"><td>int32</td>
<td>integer</td>
<td>int</td>
<td>4</td>
<td>int</td>
</tr>
<tr class="row-even"><td>uint32</td>
<td>unsigned integer</td>
<td>unsigned int</td>
<td>4</td>
<td>long</td>
</tr>
<tr class="row-odd"><td>int64</td>
<td>64-bit integer</td>
<td>long long</td>
<td>8</td>
<td>long</td>
</tr>
<tr class="row-even"><td>uint64</td>
<td>unsigned 64-bit integer</td>
<td>unsigned long long</td>
<td>8</td>
<td>long</td>
</tr>
<tr class="row-odd"><td>float16 <a class="footnote-reference" href="#id8" id="id1">[1]</a></td>
<td>half-precision float</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>2</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
</tr>
<tr class="row-even"><td>float32</td>
<td>single-precision float</td>
<td>float</td>
<td>4</td>
<td>float</td>
</tr>
<tr class="row-odd"><td>float64</td>
<td>double-precision float</td>
<td>double</td>
<td>8</td>
<td>float</td>
</tr>
<tr class="row-even"><td>float96 <a class="footnote-reference" href="#id8" id="id2">[1]</a> <a class="footnote-reference" href="#id9" id="id3">[2]</a></td>
<td>extended precision float</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>12</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
</tr>
<tr class="row-odd"><td>float128 <a class="footnote-reference" href="#id8" id="id4">[1]</a> <a class="footnote-reference" href="#id9" id="id5">[2]</a></td>
<td>extended precision float</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>16</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
</tr>
<tr class="row-even"><td>complex64</td>
<td>single-precision complex</td>
<td>struct {float r, i;}</td>
<td>8</td>
<td>complex</td>
</tr>
<tr class="row-odd"><td>complex128</td>
<td>double-precision complex</td>
<td>struct {double r, i;}</td>
<td>16</td>
<td>complex</td>
</tr>
<tr class="row-even"><td>complex192 <a class="footnote-reference" href="#id8" id="id6">[1]</a></td>
<td>extended precision complex</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>24</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
</tr>
<tr class="row-odd"><td>complex256 <a class="footnote-reference" href="#id8" id="id7">[1]</a></td>
<td>extended precision complex</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>32</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
</tr>
<tr class="row-even"><td>string</td>
<td>arbitrary length string</td>
<td>char[]</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>str</td>
</tr>
<tr class="row-odd"><td>time32</td>
<td>integer time</td>
<td>POSIX&#8217;s time_t</td>
<td>4</td>
<td>int</td>
</tr>
<tr class="row-even"><td>time64</td>
<td>floating point time</td>
<td>POSIX&#8217;s struct timeval</td>
<td>8</td>
<td>float</td>
</tr>
<tr class="row-odd"><td>enum</td>
<td>enumerated value</td>
<td>enum</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Footnotes</p>
<table class="docutils footnote" frame="void" id="id8" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[1]</td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id2">2</a>, <a class="fn-backref" href="#id4">3</a>, <a class="fn-backref" href="#id6">4</a>, <a class="fn-backref" href="#id7">5</a>)</em> see the above <a class="reference internal" href="#floating-point-note"><em>note on floating point types</em></a>.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id9" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[2]</td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id5">2</a>)</em> currently in <a class="reference external" href="http://www.numpy.org">numpy</a>. &#8220;float96&#8221; and &#8220;float128&#8221; are equivalent of
&#8220;longdouble&#8221; i.e. 80 bit extended precision floating point.</td></tr>
</tbody>
</table>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
        <p class="logo"><a href="../index.html">
          <img class="logo" src="../_static/logo-pytables-small.png" alt="Logo"/>
        </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="filenode.html"
                        title="previous chapter">filenode - simulating a filesystem with PyTables</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="condition_syntax.html"
                        title="next chapter">Condition Syntax</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/usersguide/datatypes.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="relbar-bottom">
        
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="../np-modindex.html" title="Python Module Index"
             >modules</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="condition_syntax.html" title="Condition Syntax"
             >next</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="filenode.html" title="filenode - simulating a filesystem with PyTables"
             >previous</a> &nbsp; &nbsp;</li>
    <li><a href="../index.html">PyTables 3.0.0 documentation</a> &raquo;</li>

          <li><a href="index.html" >PyTables User&#8217;s Guide</a> &raquo;</li> 
      </ul>
    </div>
    </div>

    <div class="footer">
        &copy; Copyright 2011-2013, PyTables maintainers.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
    <!-- cloud_sptheme 1.3 -->
  </body>
</html>