# Change data type of hail table column

**URL:** <https://discuss.hail.is/t/change-data-type-of-hail-table-column/1248>\
**Category:** Hail Query & hailctl\
**Created:** [January 16, 2020, 5:38pm UTC](https://discuss.hail.is/t/change-data-type-of-hail-table-column/1248 "2020-01-16T17:38:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![orr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/orr/32/846_2.png) [@orr](https://discuss.hail.is/u/orr)\
**Post date:** [January 16, 2020, 5:38pm UTC](https://discuss.hail.is/t/change-data-type-of-hail-table-column/1248/1 "2020-01-16T17:38:33Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [January 16, 2020, 5:42pm UTC](https://discuss.hail.is/t/change-data-type-of-hail-table-column/1248/2 "2020-01-16T17:42:24Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![orr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/orr/32/846_2.png) [@orr](https://discuss.hail.is/u/orr)\
**Post date:** [January 16, 2020, 6:12pm UTC](https://discuss.hail.is/t/change-data-type-of-hail-table-column/1248/3 "2020-01-16T18:12:53Z")

</div>

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

Thank you!

---

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [January 16, 2020, 7:19pm UTC](https://discuss.hail.is/t/change-data-type-of-hail-table-column/1248/4 "2020-01-16T19:19:57Z")

</div>

You’re welcome! No worries, all questions are welcome! You may find the [Table Overview](https://hail.is/docs/0.2/overview/table.html) helpful!
