You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2021/09/01 14:38:37 UTC

[arrow-cookbook] branch main updated: Creating tables recipe (#51)

This is an automated email from the ASF dual-hosted git repository.

apitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-cookbook.git


The following commit(s) were added to refs/heads/main by this push:
     new 60898b1  Creating tables recipe (#51)
60898b1 is described below

commit 60898b17cb875f73c03ed6cffeba6ee695a28d96
Author: Alessandro Molina <am...@turbogears.org>
AuthorDate: Wed Sep 1 16:38:35 2021 +0200

    Creating tables recipe (#51)
    
    https://issues.apache.org/jira/browse/ARROW-13715
---
 python/source/create.rst | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/python/source/create.rst b/python/source/create.rst
index e52c058..acf25e2 100644
--- a/python/source/create.rst
+++ b/python/source/create.rst
@@ -7,6 +7,32 @@ Tensors and all other Arrow entities.
 
 .. contents::
 
+Creating Tables
+===============
+
+Arrow supports tabular data in :class:`pyarrow.Table`: each column
+is represented by a :class:`pyarrow.ChunkedArray` and tables can be created
+by pairing multiple arrays with names for their columns
+
+.. testcode::
+
+    import pyarrow as pa
+
+    table = pa.table([
+        pa.array([1, 2, 3, 4, 5]),
+        pa.array(["a", "b", "c", "d", "e"]),
+        pa.array([1.0, 2.0, 3.0, 4.0, 5.0])
+    ], names=["col1", "col2", "col3"])
+
+    print(table)
+
+.. testoutput::
+
+    pyarrow.Table
+    col1: int64
+    col2: string
+    col3: double
+
 Create Table from Plain Types
 =============================