2

Is there a way to use append_column to create a column based on columns that currently exist in a pyarrow table? I want to create a pa.struct() field using columns that already exist. Looking for something along the lines of the following:

pa_table = pa.Table.from_pandas()
pa_table.append_column(
    pa.field('new_struct_col', pa.struct([
        pa.field('col1', pa.string()),
        pa.field('col2', pa.string()),
        pa.field('col3', pa.string())])
        ),
    {pa_table.column('col1'), pa_table.column('col2'), pa_table.column('col3')}) # something like this

In this example, col1, col2, and col3 are columns that already exist in the pyarrow table.

Thanks!

R.Z.
  • 101
  • 6

0 Answers0