amol- commented on a change in pull request #81:
URL: https://github.com/apache/arrow-cookbook/pull/81#discussion_r726933813
##########
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:
Will have to update the whole cookbook once v6 releases as that will
change the `testouput` of all tables. Already planned to do so
--
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]