Change data type of hail table column

How do I change the data type of all rows in a column (e.g. from float64 to str, similar to pandas.to_string)? I tried hl.literal, but can’t seem to accept rows.

Thanks!

Can you give an example of what you’ve tried? I don’t understand what you mean by “the data type of all rows in a column”.

If you have a field called idx which has type hl.tint32 and you can create a field called str_idx which contains its decimal string representation with annotate and hl.str as below:

import hail as hl
t = hl.utils.range_table(10)
t = t.annotate(str_idx = hl.str(t.idx))

Yes exactly, sorry for the simple question- I could not find the correct syntax in the docs/google/here.

Thank you!

You’re welcome! No worries, all questions are welcome! You may find the Table Overview helpful!

1 Like