How to add new columns in Hail table?

Hi,
MatrixTable 's annotate_cols adds new column fields. Table 's annotate adds new row fields.

Is there any way to add a new column to the hail table? We tried the below code but its throwing the following error “TypeError: ‘Table’ object does not support item assignment”

Code: ht[‘esp6500siv2_all’] = ht[‘AA_AF’]+ht[‘EA_AF’]

Regards,
Gopi

We try to avoid calling table fields “columns” because “column” has a particular meaning for matrix tables, and also often connotes homogenous kinds of data between columns.

The analog of a Pandas DataFrame ‘column’ is a table row field. annotate is exactly what you need here:

ht = ht.annotate(esp6500siv2_all = ht[‘AA_AF’]+ht[‘EA_AF’])

Is there a way to specify the location of the new fields? For example, creating FID and IID fields to place in the first 2 collumns of the table. The default is to add them at the end.

Generally we don’t consider the order of fields significant. Why do you want them first?

I assume you want this for export. I think the only way to achieve this is:

key = ht.key
ht = ht.key_by()
ht = ht.order_by(*key)
ht = ht.select(fields, in, the, order, you, want, ...)
ht.export(...)