pitrou commented on a change in pull request #81:
URL: https://github.com/apache/arrow-cookbook/pull/81#discussion_r726033532
##########
File path: python/source/data.rst
##########
@@ -182,6 +182,54 @@ We can combine them into a single table using
:func:`pyarrow.concat_tables`:
cast data from one type to another (if `promote=True`). In such cases the
data
will need to be copied and an extra cost will occur.
+Adding a column to an existing Table
+====================================
+
+If you have a table it is possible to extend its columns using
+:meth:`pyarrow.Table.append_column`
+
+Suppose we have a table with oscar nominations for each actress
Review comment:
Are you sure that's the case? I doubt a single person won 21 oscars. 21
seems to be the number of nominations for Meryl Streep.
##########
File path: python/source/data.rst
##########
@@ -182,6 +182,54 @@ We can combine them into a single table using
:func:`pyarrow.concat_tables`:
cast data from one type to another (if `promote=True`). In such cases the
data
will need to be copied and an extra cost will occur.
+Adding a column to an existing Table
+====================================
+
+If you have a table it is possible to extend its columns using
+:meth:`pyarrow.Table.append_column`
+
+Suppose we have a table with oscar nominations for each actress
+
+.. testcode::
+
+ import pyarrow as pa
+
+ oscar_nominations = pa.table([
+ ["Meryl Streep", "Katharine Hepburn"],
+ [21, 12]
+ ], names=["actor", "nominations"])
Review comment:
Nit: do you want to say "actress"?
##########
File path: python/source/data.rst
##########
@@ -182,6 +182,54 @@ We can combine them into a single table using
:func:`pyarrow.concat_tables`:
cast data from one type to another (if `promote=True`). In such cases the
data
will need to be copied and an extra cost will occur.
+Adding a column to an existing Table
+====================================
+
+If you have a table it is possible to extend its columns using
+:meth:`pyarrow.Table.append_column`
+
+Suppose we have a table with oscar nominations for each actress
+
+.. testcode::
+
+ import pyarrow as pa
+
+ oscar_nominations = pa.table([
+ ["Meryl Streep", "Katharine Hepburn"],
+ [21, 12]
+ ], names=["actor", "nominations"])
+
+ print(oscar_nominations)
+
+.. testoutput::
+
+ pyarrow.Table
+ actor: string
+ nominations: int64
Review comment:
Do you want to update this now you have added a summary to the Table
repr?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]