| |
| |
| |
| <!DOCTYPE html> |
| <html class="writer-html5" lang="en" > |
| <head> |
| <meta charset="utf-8"> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| <title>pyarrow.Table — Apache Arrow v2.0.0</title> |
| |
| |
| |
| <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" /> |
| <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> |
| |
| |
| |
| |
| |
| |
| |
| <!--[if lt IE 9]> |
| <script src="../../_static/js/html5shiv.min.js"></script> |
| <![endif]--> |
| |
| |
| <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script> |
| <script src="../../_static/jquery.js"></script> |
| <script src="../../_static/underscore.js"></script> |
| <script src="../../_static/doctools.js"></script> |
| <script src="../../_static/language_data.js"></script> |
| |
| <script type="text/javascript" src="../../_static/js/theme.js"></script> |
| |
| |
| <link rel="canonical" href="https://arrow.apache.org/docs/python/generated/pyarrow.Table.html" /> |
| <link rel="index" title="Index" href="../../genindex.html" /> |
| <link rel="search" title="Search" href="../../search.html" /> |
| <link rel="next" title="pyarrow.Tensor" href="pyarrow.Tensor.html" /> |
| <link rel="prev" title="pyarrow.RecordBatch" href="pyarrow.RecordBatch.html" /> |
|
|
|
|
| <!-- Matomo -->
|
| <script>
|
| var _paq = window._paq = window._paq || [];
|
| /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
| _paq.push(["setDoNotTrack", true]);
|
| _paq.push(["disableCookies"]);
|
| _paq.push(['trackPageView']);
|
| _paq.push(['enableLinkTracking']);
|
| (function() {
|
| var u="https://analytics.apache.org/";
|
| _paq.push(['setTrackerUrl', u+'matomo.php']);
|
| _paq.push(['setSiteId', '20']);
|
| var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
| g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
| })();
|
| </script>
|
| <!-- End Matomo Code -->
|
|
|
| </head> |
| |
| <body class="wy-body-for-nav"> |
| |
| |
| <div class="wy-grid-for-nav"> |
| |
| <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| <div class="wy-side-scroll"> |
| <div class="wy-side-nav-search" > |
| |
| |
| |
| <a href="../../index.html" class="icon icon-home" alt="Documentation Home"> Apache Arrow |
| |
| |
| |
| </a> |
| |
| |
| |
| |
| <div class="version"> |
| 2.0.0 |
| </div> |
| |
| |
| |
| |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search docs" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| |
| |
| </div> |
| |
| |
| <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
| |
| |
| |
| |
| |
| |
| <p class="caption"><span class="caption-text">Specifications and Protocols</span></p> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="../../format/Versioning.html">Format Versioning and Stability</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../format/Columnar.html">Arrow Columnar Format</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../format/Flight.html">Arrow Flight RPC</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../format/Integration.html">Integration Testing</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../format/CDataInterface.html">The Arrow C data interface</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../format/CStreamInterface.html">The Arrow C stream interface</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../format/Other.html">Other Data Structures</a></li> |
| </ul> |
| <p class="caption"><span class="caption-text">Libraries</span></p> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../../status.html">Implementation Status</a></li> |
| <li class="toctree-l1"><a class="reference external" href="https://arrow.apache.org/docs/c_glib/">C/GLib</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../cpp/index.html">C++</a></li> |
| <li class="toctree-l1"><a class="reference external" href="https://github.com/apache/arrow/blob/master/csharp/README.md">C#</a></li> |
| <li class="toctree-l1"><a class="reference external" href="https://godoc.org/github.com/apache/arrow/go/arrow">Go</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../java/index.html">Java</a></li> |
| <li class="toctree-l1"><a class="reference external" href="https://arrow.apache.org/docs/js/">JavaScript</a></li> |
| <li class="toctree-l1"><a class="reference external" href="https://github.com/apache/arrow/blob/master/matlab/README.md">MATLAB</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="../index.html">Python</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="../install.html">Installing PyArrow</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../memory.html">Memory and IO Interfaces</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../data.html">Data Types and In-Memory Data Model</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../compute.html">Compute Functions</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../ipc.html">Streaming, Serialization, and IPC</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../filesystems.html">Filesystem Interface</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../filesystems_deprecated.html">Filesystem Interface (legacy)</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../plasma.html">The Plasma In-Memory Object Store</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../numpy.html">NumPy Integration</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../pandas.html">Pandas Integration</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../timestamps.html">Timestamps</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../csv.html">Reading CSV files</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../feather.html">Feather File Format</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../json.html">Reading JSON files</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../parquet.html">Reading and Writing the Apache Parquet Format</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../dataset.html">Tabular Datasets</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../cuda.html">CUDA Integration</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../extending_types.html">Extending pyarrow</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../extending.html">Using pyarrow from C++ and Cython Code</a></li> |
| <li class="toctree-l2 current"><a class="reference internal" href="../api.html">API Reference</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="../api/datatypes.html">Data Types and Schemas</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/arrays.html">Arrays and Scalars</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/memory.html">Buffers and Memory</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/compute.html">Compute Functions</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/files.html">Streams and File Access</a></li> |
| <li class="toctree-l3 current"><a class="reference internal" href="../api/tables.html">Tables and Tensors</a><ul class="current"> |
| <li class="toctree-l4"><a class="reference internal" href="../api/tables.html#factory-functions">Factory Functions</a></li> |
| <li class="toctree-l4 current"><a class="reference internal" href="../api/tables.html#classes">Classes</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../api/tables.html#tensors">Tensors</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/ipc.html">Serialization and IPC</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/flight.html">Arrow Flight</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/formats.html">Tabular File Formats</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/filesystems.html">Filesystems</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/dataset.html">Dataset</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/plasma.html">Plasma In-Memory Object Store</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/cuda.html">CUDA Integration</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../api/misc.html">Miscellaneous</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../getting_involved.html">Getting Involved</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../benchmarks.html">Benchmarks</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference external" href="https://arrow.apache.org/docs/r/">R</a></li> |
| <li class="toctree-l1"><a class="reference external" href="https://github.com/apache/arrow/blob/master/ruby/README.md">Ruby</a></li> |
| <li class="toctree-l1"><a class="reference external" href="https://docs.rs/crate/arrow/">Rust</a></li> |
| </ul> |
| <p class="caption"><span class="caption-text">Development</span></p> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="../../developers/contributing.html">Contributing to Apache Arrow</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../developers/cpp/index.html">C++ Development</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../developers/python.html">Python Development</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../developers/archery.html">Daily Development using Archery</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../developers/crossbow.html">Packaging and Testing with Crossbow</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../developers/docker.html">Running Docker Builds</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../developers/benchmarks.html">Benchmarks</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../developers/documentation.html">Building the Documentation</a></li> |
| </ul> |
| |
| |
| |
| </div> |
| |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
| |
| |
| <nav class="wy-nav-top" aria-label="top navigation"> |
| |
| <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| <a href="../../index.html">Apache Arrow</a> |
| |
| </nav> |
| |
| |
| <div class="wy-nav-content"> |
| |
| <div class="rst-content"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <div role="navigation" aria-label="breadcrumbs navigation"> |
| |
| <ul class="wy-breadcrumbs"> |
| |
| <li><a href="../../index.html" class="icon icon-home"></a> »</li> |
| |
| <li><a href="../index.html">Python bindings</a> »</li> |
| |
| <li><a href="../api.html">API Reference</a> »</li> |
| |
| <li><a href="../api/tables.html">Tables and Tensors</a> »</li> |
| |
| <li>pyarrow.Table</li> |
| |
| |
| <li class="wy-breadcrumbs-aside"> |
| |
| |
| <a href="../../_sources/python/generated/pyarrow.Table.rst.txt" rel="nofollow"> View page source</a> |
| |
| |
| </li> |
| |
| </ul> |
| |
| |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <div class="section" id="pyarrow-table"> |
| <h1>pyarrow.Table<a class="headerlink" href="#pyarrow-table" title="Permalink to this headline">¶</a></h1> |
| <dl class="py class"> |
| <dt id="pyarrow.Table"> |
| <em class="property">class </em><code class="sig-prename descclassname">pyarrow.</code><code class="sig-name descname">Table</code><a class="headerlink" href="#pyarrow.Table" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pyarrow.lib._PandasConvertible</span></code></p> |
| <p>A collection of top-level named, equal length Arrow arrays.</p> |
| <div class="admonition warning"> |
| <p class="admonition-title">Warning</p> |
| <p>Do not call this class’s constructor directly, use one of the <code class="docutils literal notranslate"><span class="pre">from_*</span></code> |
| methods instead.</p> |
| </div> |
| <dl class="py method"> |
| <dt id="pyarrow.Table.__init__"> |
| <code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.__init__" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Initialize self. See help(type(self)) for accurate signature.</p> |
| </dd></dl> |
| |
| <p class="rubric">Methods</p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.__init__" title="pyarrow.Table.__init__"><code class="xref py py-obj docutils literal notranslate"><span class="pre">__init__</span></code></a>(*args, **kwargs)</p></td> |
| <td><p>Initialize self.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.add_column" title="pyarrow.Table.add_column"><code class="xref py py-obj docutils literal notranslate"><span class="pre">add_column</span></code></a>(self, int i, field_, column)</p></td> |
| <td><p>Add column to Table at position.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.append_column" title="pyarrow.Table.append_column"><code class="xref py py-obj docutils literal notranslate"><span class="pre">append_column</span></code></a>(self, field_, column)</p></td> |
| <td><p>Append column at end of columns.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.cast" title="pyarrow.Table.cast"><code class="xref py py-obj docutils literal notranslate"><span class="pre">cast</span></code></a>(self, Schema target_schema, bool safe=True)</p></td> |
| <td><p>Cast table values to another schema</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.column" title="pyarrow.Table.column"><code class="xref py py-obj docutils literal notranslate"><span class="pre">column</span></code></a>(self, i)</p></td> |
| <td><p>Select a column by its column name, or numeric index.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.combine_chunks" title="pyarrow.Table.combine_chunks"><code class="xref py py-obj docutils literal notranslate"><span class="pre">combine_chunks</span></code></a>(self, MemoryPool memory_pool=None)</p></td> |
| <td><p>Make a new table by combining the chunks this table has.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.drop" title="pyarrow.Table.drop"><code class="xref py py-obj docutils literal notranslate"><span class="pre">drop</span></code></a>(self, columns)</p></td> |
| <td><p>Drop one or more columns and return a new table.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.equals" title="pyarrow.Table.equals"><code class="xref py py-obj docutils literal notranslate"><span class="pre">equals</span></code></a>(self, Table other, …)</p></td> |
| <td><p>Check if contents of two tables are equal.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.field" title="pyarrow.Table.field"><code class="xref py py-obj docutils literal notranslate"><span class="pre">field</span></code></a>(self, i)</p></td> |
| <td><p>Select a schema field by its column name or numeric index.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.filter" title="pyarrow.Table.filter"><code class="xref py py-obj docutils literal notranslate"><span class="pre">filter</span></code></a>(self, mask[, null_selection_behavior])</p></td> |
| <td><p>Select records from a Table.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.flatten" title="pyarrow.Table.flatten"><code class="xref py py-obj docutils literal notranslate"><span class="pre">flatten</span></code></a>(self, MemoryPool memory_pool=None)</p></td> |
| <td><p>Flatten this Table.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.from_arrays" title="pyarrow.Table.from_arrays"><code class="xref py py-obj docutils literal notranslate"><span class="pre">from_arrays</span></code></a>(arrays[, names, schema, metadata])</p></td> |
| <td><p>Construct a Table from Arrow arrays</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.from_batches" title="pyarrow.Table.from_batches"><code class="xref py py-obj docutils literal notranslate"><span class="pre">from_batches</span></code></a>(batches, Schema schema=None)</p></td> |
| <td><p>Construct a Table from a sequence or iterator of Arrow RecordBatches.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.from_pandas" title="pyarrow.Table.from_pandas"><code class="xref py py-obj docutils literal notranslate"><span class="pre">from_pandas</span></code></a>(type cls, df, Schema schema=None)</p></td> |
| <td><p>Convert pandas.DataFrame to an Arrow Table.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.from_pydict" title="pyarrow.Table.from_pydict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">from_pydict</span></code></a>(mapping[, schema, metadata])</p></td> |
| <td><p>Construct a Table from Arrow arrays or columns</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.itercolumns" title="pyarrow.Table.itercolumns"><code class="xref py py-obj docutils literal notranslate"><span class="pre">itercolumns</span></code></a>(self)</p></td> |
| <td><p>Iterator over all columns in their numerical order.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.remove_column" title="pyarrow.Table.remove_column"><code class="xref py py-obj docutils literal notranslate"><span class="pre">remove_column</span></code></a>(self, int i)</p></td> |
| <td><p>Create new Table with the indicated column removed.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.rename_columns" title="pyarrow.Table.rename_columns"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rename_columns</span></code></a>(self, names)</p></td> |
| <td><p>Create new table with columns renamed to provided names.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.replace_schema_metadata" title="pyarrow.Table.replace_schema_metadata"><code class="xref py py-obj docutils literal notranslate"><span class="pre">replace_schema_metadata</span></code></a>(self[, metadata])</p></td> |
| <td><p>EXPERIMENTAL: Create shallow copy of table by replacing schema key-value metadata with the indicated new metadata (which may be None, which deletes any existing metadata</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.select" title="pyarrow.Table.select"><code class="xref py py-obj docutils literal notranslate"><span class="pre">select</span></code></a>(self, columns)</p></td> |
| <td><p>Select columns of the Table.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.set_column" title="pyarrow.Table.set_column"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_column</span></code></a>(self, int i, field_, column)</p></td> |
| <td><p>Replace column in Table at position.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.slice" title="pyarrow.Table.slice"><code class="xref py py-obj docutils literal notranslate"><span class="pre">slice</span></code></a>(self[, offset, length])</p></td> |
| <td><p>Compute zero-copy slice of this Table</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.take" title="pyarrow.Table.take"><code class="xref py py-obj docutils literal notranslate"><span class="pre">take</span></code></a>(self, indices)</p></td> |
| <td><p>Select records from an Table.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.to_batches" title="pyarrow.Table.to_batches"><code class="xref py py-obj docutils literal notranslate"><span class="pre">to_batches</span></code></a>(self[, max_chunksize])</p></td> |
| <td><p>Convert Table to list of (contiguous) RecordBatch objects.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.to_pandas" title="pyarrow.Table.to_pandas"><code class="xref py py-obj docutils literal notranslate"><span class="pre">to_pandas</span></code></a>(self[, memory_pool, categories, …])</p></td> |
| <td><p>Convert to a pandas-compatible NumPy array or DataFrame, as appropriate</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.to_pydict" title="pyarrow.Table.to_pydict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">to_pydict</span></code></a>(self)</p></td> |
| <td><p>Convert the Table to a dict or OrderedDict.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.to_string" title="pyarrow.Table.to_string"><code class="xref py py-obj docutils literal notranslate"><span class="pre">to_string</span></code></a>(self[, show_metadata])</p></td> |
| <td><p></p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.validate" title="pyarrow.Table.validate"><code class="xref py py-obj docutils literal notranslate"><span class="pre">validate</span></code></a>(self, *[, full])</p></td> |
| <td><p>Perform validation checks.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <p class="rubric">Attributes</p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.column_names" title="pyarrow.Table.column_names"><code class="xref py py-obj docutils literal notranslate"><span class="pre">column_names</span></code></a></p></td> |
| <td><p>Names of the table’s columns</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.columns" title="pyarrow.Table.columns"><code class="xref py py-obj docutils literal notranslate"><span class="pre">columns</span></code></a></p></td> |
| <td><p>List of all columns in numerical order.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.nbytes" title="pyarrow.Table.nbytes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">nbytes</span></code></a></p></td> |
| <td><p>Total number of bytes consumed by the elements of the table.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.num_columns" title="pyarrow.Table.num_columns"><code class="xref py py-obj docutils literal notranslate"><span class="pre">num_columns</span></code></a></p></td> |
| <td><p>Number of columns in this table.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.num_rows" title="pyarrow.Table.num_rows"><code class="xref py py-obj docutils literal notranslate"><span class="pre">num_rows</span></code></a></p></td> |
| <td><p>Number of rows in this table.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#pyarrow.Table.schema" title="pyarrow.Table.schema"><code class="xref py py-obj docutils literal notranslate"><span class="pre">schema</span></code></a></p></td> |
| <td><p>Schema of the table and its columns.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#pyarrow.Table.shape" title="pyarrow.Table.shape"><code class="xref py py-obj docutils literal notranslate"><span class="pre">shape</span></code></a></p></td> |
| <td><p>(#rows, #columns).</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <dl class="py method"> |
| <dt id="pyarrow.Table.add_column"> |
| <code class="sig-name descname">add_column</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">int i</em>, <em class="sig-param">field_</em>, <em class="sig-param">column</em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.add_column" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Add column to Table at position.</p> |
| <p>A new table is returned with the column added, the original table |
| object is left unchanged.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>i</strong> (<em>int</em>) – Index to place the column at.</p></li> |
| <li><p><strong>field</strong> (<em>str</em><em> or </em><a class="reference internal" href="pyarrow.Field.html#pyarrow.Field" title="pyarrow.Field"><em>Field</em></a>) – If a string is passed then the type is deduced from the column |
| data.</p></li> |
| <li><p><strong>column</strong> (<a class="reference internal" href="pyarrow.Array.html#pyarrow.Array" title="pyarrow.Array"><em>Array</em></a><em>, </em><em>list of Array</em><em>, or </em><em>values coercible to arrays</em>) – Column data.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>pyarrow.Table</strong> (<em>New table with the passed column added.</em>)</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.append_column"> |
| <code class="sig-name descname">append_column</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">field_</span></em>, <em class="sig-param"><span class="n">column</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.append_column" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Append column at end of columns.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>field</strong> (<em>str</em><em> or </em><a class="reference internal" href="pyarrow.Field.html#pyarrow.Field" title="pyarrow.Field"><em>Field</em></a>) – If a string is passed then the type is deduced from the column |
| data.</p></li> |
| <li><p><strong>column</strong> (<a class="reference internal" href="pyarrow.Array.html#pyarrow.Array" title="pyarrow.Array"><em>Array</em></a><em>, </em><em>list of Array</em><em>, or </em><em>values coercible to arrays</em>) – Column data.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><em>pyarrow.Table</em> – New table with the passed column added.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.cast"> |
| <code class="sig-name descname">cast</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">Schema target_schema</em>, <em class="sig-param">bool safe=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.cast" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Cast table values to another schema</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>target_schema</strong> (<a class="reference internal" href="pyarrow.Schema.html#pyarrow.Schema" title="pyarrow.Schema"><em>Schema</em></a>) – Schema to cast to, the names and order of fields must match</p></li> |
| <li><p><strong>safe</strong> (<em>bool</em><em>, </em><em>default True</em>) – Check for overflows or other unsafe conversions</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>casted</strong> (<em>Table</em>)</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.column"> |
| <code class="sig-name descname">column</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.column" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Select a column by its column name, or numeric index.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>i</strong> (<em>int</em><em> or </em><em>string</em>) – The index or name of the column to retrieve.</p> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><em>pyarrow.ChunkedArray</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py attribute"> |
| <dt id="pyarrow.Table.column_names"> |
| <code class="sig-name descname">column_names</code><a class="headerlink" href="#pyarrow.Table.column_names" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Names of the table’s columns</p> |
| </dd></dl> |
| |
| <dl class="py attribute"> |
| <dt id="pyarrow.Table.columns"> |
| <code class="sig-name descname">columns</code><a class="headerlink" href="#pyarrow.Table.columns" title="Permalink to this definition">¶</a></dt> |
| <dd><p>List of all columns in numerical order.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Returns</dt> |
| <dd class="field-odd"><p><em>list of pa.ChunkedArray</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.combine_chunks"> |
| <code class="sig-name descname">combine_chunks</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">MemoryPool memory_pool=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.combine_chunks" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Make a new table by combining the chunks this table has.</p> |
| <p>All the underlying chunks in the ChunkedArray of each column are |
| concatenated into zero or one chunk.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>memory_pool</strong> (<a class="reference internal" href="pyarrow.MemoryPool.html#pyarrow.MemoryPool" title="pyarrow.MemoryPool"><em>MemoryPool</em></a><em>, </em><em>default None</em>) – For memory allocations, if required, otherwise use default pool</p> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>result</strong> (<em>Table</em>)</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.drop"> |
| <code class="sig-name descname">drop</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">columns</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.drop" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Drop one or more columns and return a new table.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>columns</strong> (<em>list of str</em>) – List of field names referencing existing columns.</p> |
| </dd> |
| </dl> |
| <p>:raises KeyError : if any of the passed columns name are not existing.:</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Returns</dt> |
| <dd class="field-odd"><p><em>pyarrow.Table</em> – New table without the columns.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.equals"> |
| <code class="sig-name descname">equals</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">Table other</em>, <em class="sig-param">bool check_metadata=False</em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.equals" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Check if contents of two tables are equal.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>other</strong> (<a class="reference internal" href="#pyarrow.Table" title="pyarrow.Table"><em>pyarrow.Table</em></a>) – Table to compare against.</p></li> |
| <li><p><strong>check_metadata</strong> (<em>bool</em><em>, </em><em>default False</em>) – Whether schema metadata equality should be checked as well.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>are_equal</strong> (<em>bool</em>)</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.field"> |
| <code class="sig-name descname">field</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.field" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Select a schema field by its column name or numeric index.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>i</strong> (<em>int</em><em> or </em><em>string</em>) – The index or name of the field to retrieve.</p> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><em>pyarrow.Field</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.filter"> |
| <code class="sig-name descname">filter</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">mask</span></em>, <em class="sig-param"><span class="n">null_selection_behavior</span><span class="o">=</span><span class="default_value">'drop'</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.filter" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Select records from a Table. See pyarrow.compute.filter for full usage.</p> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.flatten"> |
| <code class="sig-name descname">flatten</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">MemoryPool memory_pool=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.flatten" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Flatten this Table. Each column with a struct type is flattened |
| into one column per struct field. Other columns are left unchanged.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>memory_pool</strong> (<a class="reference internal" href="pyarrow.MemoryPool.html#pyarrow.MemoryPool" title="pyarrow.MemoryPool"><em>MemoryPool</em></a><em>, </em><em>default None</em>) – For memory allocations, if required, otherwise use default pool</p> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>result</strong> (<em>Table</em>)</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.from_arrays"> |
| <em class="property">static </em><code class="sig-name descname">from_arrays</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">arrays</span></em>, <em class="sig-param"><span class="n">names</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">schema</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.from_arrays" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Construct a Table from Arrow arrays</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>arrays</strong> (<em>list of pyarrow.Array</em><em> or </em><a class="reference internal" href="pyarrow.ChunkedArray.html#pyarrow.ChunkedArray" title="pyarrow.ChunkedArray"><em>pyarrow.ChunkedArray</em></a>) – Equal-length arrays that should form the table.</p></li> |
| <li><p><strong>names</strong> (<em>list of str</em><em>, </em><em>optional</em>) – Names for the table columns. If not passed, schema must be passed</p></li> |
| <li><p><strong>schema</strong> (<a class="reference internal" href="pyarrow.Schema.html#pyarrow.Schema" title="pyarrow.Schema"><em>Schema</em></a><em>, </em><em>default None</em>) – Schema for the created table. If not passed, names must be passed</p></li> |
| <li><p><strong>metadata</strong> (<em>dict</em><em> or </em><em>Mapping</em><em>, </em><em>default None</em>) – Optional metadata for the schema (if inferred).</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><em>pyarrow.Table</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.from_batches"> |
| <em class="property">static </em><code class="sig-name descname">from_batches</code><span class="sig-paren">(</span><em class="sig-param">batches</em>, <em class="sig-param">Schema schema=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.from_batches" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Construct a Table from a sequence or iterator of Arrow RecordBatches.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>batches</strong> (<em>sequence</em><em> or </em><em>iterator of RecordBatch</em>) – Sequence of RecordBatch to be converted, all schemas must be equal.</p></li> |
| <li><p><strong>schema</strong> (<a class="reference internal" href="pyarrow.Schema.html#pyarrow.Schema" title="pyarrow.Schema"><em>Schema</em></a><em>, </em><em>default None</em>) – If not passed, will be inferred from the first RecordBatch.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>table</strong> (<em>Table</em>)</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.from_pandas"> |
| <code class="sig-name descname">from_pandas</code><span class="sig-paren">(</span><em class="sig-param">type cls</em>, <em class="sig-param">df</em>, <em class="sig-param">Schema schema=None</em>, <em class="sig-param">preserve_index=None</em>, <em class="sig-param">nthreads=None</em>, <em class="sig-param">columns=None</em>, <em class="sig-param">bool safe=True</em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.from_pandas" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Convert pandas.DataFrame to an Arrow Table.</p> |
| <p>The column types in the resulting Arrow Table are inferred from the |
| dtypes of the pandas.Series in the DataFrame. In the case of non-object |
| Series, the NumPy dtype is translated to its Arrow equivalent. In the |
| case of <cite>object</cite>, we need to guess the datatype by looking at the |
| Python objects in this Series.</p> |
| <p>Be aware that Series of the <cite>object</cite> dtype don’t carry enough |
| information to always lead to a meaningful Arrow type. In the case that |
| we cannot infer a type, e.g. because the DataFrame is of length 0 or |
| the Series only contains None/nan objects, the type is set to |
| null. This behavior can be avoided by constructing an explicit schema |
| and passing it to this function.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>df</strong> (<em>pandas.DataFrame</em>) – </p></li> |
| <li><p><strong>schema</strong> (<a class="reference internal" href="pyarrow.Schema.html#pyarrow.Schema" title="pyarrow.Schema"><em>pyarrow.Schema</em></a><em>, </em><em>optional</em>) – The expected schema of the Arrow Table. This can be used to |
| indicate the type of columns if we cannot infer it automatically. |
| If passed, the output will have exactly this schema. Columns |
| specified in the schema that are not found in the DataFrame columns |
| or its index will raise an error. Additional columns or index |
| levels in the DataFrame which are not specified in the schema will |
| be ignored.</p></li> |
| <li><p><strong>preserve_index</strong> (<em>bool</em><em>, </em><em>optional</em>) – Whether to store the index as an additional column in the resulting |
| <code class="docutils literal notranslate"><span class="pre">Table</span></code>. The default of None will store the index as a column, |
| except for RangeIndex which is stored as metadata only. Use |
| <code class="docutils literal notranslate"><span class="pre">preserve_index=True</span></code> to force it to be stored as a column.</p></li> |
| <li><p><strong>nthreads</strong> (<em>int</em><em>, </em><em>default None</em><em> (</em><em>may use up to system CPU count threads</em><em>)</em>) – If greater than 1, convert columns to Arrow in parallel using |
| indicated number of threads</p></li> |
| <li><p><strong>columns</strong> (<em>list</em><em>, </em><em>optional</em>) – List of column to be converted. If None, use all columns.</p></li> |
| <li><p><strong>safe</strong> (<em>bool</em><em>, </em><em>default True</em>) – Check for overflows or other unsafe conversions</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><em>pyarrow.Table</em></p> |
| </dd> |
| </dl> |
| <p class="rubric">Examples</p> |
| <div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span> |
| <span class="gp">>>> </span><span class="kn">import</span> <span class="nn">pyarrow</span> <span class="k">as</span> <span class="nn">pa</span> |
| <span class="gp">>>> </span><span class="n">df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">({</span> |
| <span class="go"> ... 'int': [1, 2],</span> |
| <span class="go"> ... 'str': ['a', 'b']</span> |
| <span class="go"> ... })</span> |
| <span class="gp">>>> </span><span class="n">pa</span><span class="o">.</span><span class="n">Table</span><span class="o">.</span><span class="n">from_pandas</span><span class="p">(</span><span class="n">df</span><span class="p">)</span> |
| <span class="go"><pyarrow.lib.Table object at 0x7f05d1fb1b40></span> |
| </pre></div> |
| </div> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.from_pydict"> |
| <em class="property">static </em><code class="sig-name descname">from_pydict</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">mapping</span></em>, <em class="sig-param"><span class="n">schema</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.from_pydict" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Construct a Table from Arrow arrays or columns</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>mapping</strong> (<em>dict</em><em> or </em><em>Mapping</em>) – A mapping of strings to Arrays or Python lists.</p></li> |
| <li><p><strong>schema</strong> (<a class="reference internal" href="pyarrow.Schema.html#pyarrow.Schema" title="pyarrow.Schema"><em>Schema</em></a><em>, </em><em>default None</em>) – If not passed, will be inferred from the Mapping values</p></li> |
| <li><p><strong>metadata</strong> (<em>dict</em><em> or </em><em>Mapping</em><em>, </em><em>default None</em>) – Optional metadata for the schema (if inferred).</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><em>pyarrow.Table</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.itercolumns"> |
| <code class="sig-name descname">itercolumns</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.itercolumns" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Iterator over all columns in their numerical order.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Yields</dt> |
| <dd class="field-odd"><p><em>pyarrow.ChunkedArray</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py attribute"> |
| <dt id="pyarrow.Table.nbytes"> |
| <code class="sig-name descname">nbytes</code><a class="headerlink" href="#pyarrow.Table.nbytes" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Total number of bytes consumed by the elements of the table.</p> |
| </dd></dl> |
| |
| <dl class="py attribute"> |
| <dt id="pyarrow.Table.num_columns"> |
| <code class="sig-name descname">num_columns</code><a class="headerlink" href="#pyarrow.Table.num_columns" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Number of columns in this table.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Returns</dt> |
| <dd class="field-odd"><p><em>int</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py attribute"> |
| <dt id="pyarrow.Table.num_rows"> |
| <code class="sig-name descname">num_rows</code><a class="headerlink" href="#pyarrow.Table.num_rows" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Number of rows in this table.</p> |
| <p>Due to the definition of a table, all columns have the same number of |
| rows.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Returns</dt> |
| <dd class="field-odd"><p><em>int</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.remove_column"> |
| <code class="sig-name descname">remove_column</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">int i</em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.remove_column" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Create new Table with the indicated column removed.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>i</strong> (<em>int</em>) – Index of column to remove.</p> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><em>pyarrow.Table</em> – New table without the column.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.rename_columns"> |
| <code class="sig-name descname">rename_columns</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">names</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.rename_columns" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Create new table with columns renamed to provided names.</p> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.replace_schema_metadata"> |
| <code class="sig-name descname">replace_schema_metadata</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.replace_schema_metadata" title="Permalink to this definition">¶</a></dt> |
| <dd><p>EXPERIMENTAL: Create shallow copy of table by replacing schema |
| key-value metadata with the indicated new metadata (which may be None, |
| which deletes any existing metadata</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>metadata</strong> (<em>dict</em><em>, </em><em>default None</em>) – </p> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>shallow_copy</strong> (<em>Table</em>)</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py attribute"> |
| <dt id="pyarrow.Table.schema"> |
| <code class="sig-name descname">schema</code><a class="headerlink" href="#pyarrow.Table.schema" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Schema of the table and its columns.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Returns</dt> |
| <dd class="field-odd"><p><em>pyarrow.Schema</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.select"> |
| <code class="sig-name descname">select</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">columns</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.select" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Select columns of the Table.</p> |
| <p>Returns a new Table with the specified columns, and metadata |
| preserved.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>columns</strong> (<em>list-like</em>) – The column names or integer indices to select.</p> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><em>Table</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.set_column"> |
| <code class="sig-name descname">set_column</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">int i</em>, <em class="sig-param">field_</em>, <em class="sig-param">column</em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.set_column" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Replace column in Table at position.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>i</strong> (<em>int</em>) – Index to place the column at.</p></li> |
| <li><p><strong>field</strong> (<em>str</em><em> or </em><a class="reference internal" href="pyarrow.Field.html#pyarrow.Field" title="pyarrow.Field"><em>Field</em></a>) – If a string is passed then the type is deduced from the column |
| data.</p></li> |
| <li><p><strong>column</strong> (<a class="reference internal" href="pyarrow.Array.html#pyarrow.Array" title="pyarrow.Array"><em>Array</em></a><em>, </em><em>list of Array</em><em>, or </em><em>values coercible to arrays</em>) – Column data.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><em>pyarrow.Table</em> – New table with the passed column set.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py attribute"> |
| <dt id="pyarrow.Table.shape"> |
| <code class="sig-name descname">shape</code><a class="headerlink" href="#pyarrow.Table.shape" title="Permalink to this definition">¶</a></dt> |
| <dd><p>(#rows, #columns).</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Returns</dt> |
| <dd class="field-odd"><p><em>(int, int)</em> – Number of rows and number of columns.</p> |
| </dd> |
| <dt class="field-even">Type</dt> |
| <dd class="field-even"><p>Dimensions of the table</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.slice"> |
| <code class="sig-name descname">slice</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">offset</span><span class="o">=</span><span class="default_value">0</span></em>, <em class="sig-param"><span class="n">length</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.slice" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Compute zero-copy slice of this Table</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>offset</strong> (<em>int</em><em>, </em><em>default 0</em>) – Offset from start of table to slice</p></li> |
| <li><p><strong>length</strong> (<em>int</em><em>, </em><em>default None</em>) – Length of slice (default is until end of table starting from |
| offset)</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>sliced</strong> (<em>Table</em>)</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.take"> |
| <code class="sig-name descname">take</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">indices</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.take" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Select records from an Table. See pyarrow.compute.take for full |
| usage.</p> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.to_batches"> |
| <code class="sig-name descname">to_batches</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">max_chunksize</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.to_batches" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Convert Table to list of (contiguous) RecordBatch objects.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>max_chunksize</strong> (<em>int</em><em>, </em><em>default None</em>) – Maximum size for RecordBatch chunks. Individual chunks may be |
| smaller depending on the chunk layout of individual columns.</p> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>batches</strong> (<em>list of RecordBatch</em>)</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.to_pandas"> |
| <code class="sig-name descname">to_pandas</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">memory_pool=None</em>, <em class="sig-param">categories=None</em>, <em class="sig-param">bool strings_to_categorical=False</em>, <em class="sig-param">bool zero_copy_only=False</em>, <em class="sig-param">bool integer_object_nulls=False</em>, <em class="sig-param">bool date_as_object=True</em>, <em class="sig-param">bool timestamp_as_object=False</em>, <em class="sig-param">bool use_threads=True</em>, <em class="sig-param">bool deduplicate_objects=True</em>, <em class="sig-param">bool ignore_metadata=False</em>, <em class="sig-param">bool safe=True</em>, <em class="sig-param">bool split_blocks=False</em>, <em class="sig-param">bool self_destruct=False</em>, <em class="sig-param">types_mapper=None</em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.to_pandas" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Convert to a pandas-compatible NumPy array or DataFrame, as appropriate</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>memory_pool</strong> (<a class="reference internal" href="pyarrow.MemoryPool.html#pyarrow.MemoryPool" title="pyarrow.MemoryPool"><em>MemoryPool</em></a><em>, </em><em>default None</em>) – Arrow MemoryPool to use for allocations. Uses the default memory |
| pool is not passed.</p></li> |
| <li><p><strong>strings_to_categorical</strong> (<em>bool</em><em>, </em><em>default False</em>) – Encode string (UTF8) and binary types to pandas.Categorical.</p></li> |
| <li><p><strong>categories</strong> (<em>list</em><em>, </em><em>default empty</em>) – List of fields that should be returned as pandas.Categorical. Only |
| applies to table-like data structures.</p></li> |
| <li><p><strong>zero_copy_only</strong> (<em>bool</em><em>, </em><em>default False</em>) – Raise an ArrowException if this function call would require copying |
| the underlying data.</p></li> |
| <li><p><strong>integer_object_nulls</strong> (<em>bool</em><em>, </em><em>default False</em>) – Cast integers with nulls to objects</p></li> |
| <li><p><strong>date_as_object</strong> (<em>bool</em><em>, </em><em>default True</em>) – Cast dates to objects. If False, convert to datetime64[ns] dtype.</p></li> |
| <li><p><strong>timestamp_as_object</strong> (<em>bool</em><em>, </em><em>default False</em>) – Cast non-nanosecond timestamps (np.datetime64) to objects. This is |
| useful if you have timestamps that don’t fit in the normal date |
| range of nanosecond timestamps (1678 CE-2262 CE). |
| If False, all timestamps are converted to datetime64[ns] dtype.</p></li> |
| <li><p><strong>use_threads</strong> (<em>bool</em><em>, </em><em>default True</em>) – Whether to parallelize the conversion using multiple threads.</p></li> |
| <li><p><strong>deduplicate_objects</strong> (<em>bool</em><em>, </em><em>default False</em>) – Do not create multiple copies Python objects when created, to save |
| on memory use. Conversion will be slower.</p></li> |
| <li><p><strong>ignore_metadata</strong> (<em>bool</em><em>, </em><em>default False</em>) – If True, do not use the ‘pandas’ metadata to reconstruct the |
| DataFrame index, if present</p></li> |
| <li><p><strong>safe</strong> (<em>bool</em><em>, </em><em>default True</em>) – For certain data types, a cast is needed in order to store the |
| data in a pandas DataFrame or Series (e.g. timestamps are always |
| stored as nanoseconds in pandas). This option controls whether it |
| is a safe cast or not.</p></li> |
| <li><p><strong>split_blocks</strong> (<em>bool</em><em>, </em><em>default False</em>) – If True, generate one internal “block” for each column when |
| creating a pandas.DataFrame from a RecordBatch or Table. While this |
| can temporarily reduce memory note that various pandas operations |
| can trigger “consolidation” which may balloon memory use.</p></li> |
| <li><p><strong>self_destruct</strong> (<em>bool</em><em>, </em><em>default False</em>) – EXPERIMENTAL: If True, attempt to deallocate the originating Arrow |
| memory while converting the Arrow object to pandas. If you use the |
| object after calling to_pandas with this option it will crash your |
| program.</p></li> |
| <li><p><strong>types_mapper</strong> (<em>function</em><em>, </em><em>default None</em>) – A function mapping a pyarrow DataType to a pandas ExtensionDtype. |
| This can be used to override the default pandas type for conversion |
| of built-in pyarrow types or in absence of pandas_metadata in the |
| Table schema. The function receives a pyarrow DataType and is |
| expected to return a pandas ExtensionDtype or <code class="docutils literal notranslate"><span class="pre">None</span></code> if the |
| default conversion should be used for that type. If you have |
| a dictionary mapping, you can pass <code class="docutils literal notranslate"><span class="pre">dict.get</span></code> as function.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><em>pandas.Series or pandas.DataFrame depending on type of object</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.to_pydict"> |
| <code class="sig-name descname">to_pydict</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.to_pydict" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Convert the Table to a dict or OrderedDict.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Returns</dt> |
| <dd class="field-odd"><p><em>dict</em></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.to_string"> |
| <code class="sig-name descname">to_string</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">show_metadata</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.to_string" title="Permalink to this definition">¶</a></dt> |
| <dd></dd></dl> |
| |
| <dl class="py method"> |
| <dt id="pyarrow.Table.validate"> |
| <code class="sig-name descname">validate</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">full</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyarrow.Table.validate" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Perform validation checks. An exception is raised if validation fails.</p> |
| <p>By default only cheap validation checks are run. Pass <cite>full=True</cite> |
| for thorough validation checks (potentially O(n)).</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>full</strong> (<em>bool</em><em>, </em><em>default False</em>) – If True, run expensive checks, otherwise cheap checks only.</p> |
| </dd> |
| <dt class="field-even">Raises</dt> |
| <dd class="field-even"><p><strong>ArrowInvalid</strong> – </p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| </div> |
| |
| |
| </div> |
| |
| </div> |
| <footer> |
| |
| <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> |
| |
| <a href="pyarrow.Tensor.html" class="btn btn-neutral float-right" title="pyarrow.Tensor" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> |
| |
| |
| <a href="pyarrow.RecordBatch.html" class="btn btn-neutral float-left" title="pyarrow.RecordBatch" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> |
| |
| </div> |
| |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p> |
| |
| © Copyright 2016-2019 Apache Software Foundation |
| |
| </p> |
| </div> |
| |
| |
| |
| Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a |
| |
| <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> |
| |
| provided by <a href="https://readthedocs.org">Read the Docs</a>. |
| |
| </footer> |
| |
| </div> |
| </div> |
| |
| </section> |
| |
| </div> |
| |
| |
| <script type="text/javascript"> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| |
| |
| |
| |
| |
| |
| </body> |
| </html> |