# Can't convert column's data type from Char to Any

**URL:** <https://discourse.julialang.org/t/cant-convert-columns-data-type-from-char-to-any/78111>\
**Category:** New to Julia\
**Tags:** question, package, dataframes\
**Created:** [March 18, 2022, 9:37pm UTC](https://discourse.julialang.org/t/cant-convert-columns-data-type-from-char-to-any/78111 "2022-03-18T21:37:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![janilin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/janilin/32/33769_2.png) [@janilin](https://discourse.julialang.org/u/janilin)\
**Post date:** [March 18, 2022, 9:37pm UTC](https://discourse.julialang.org/t/cant-convert-columns-data-type-from-char-to-any/78111/1 "2022-03-18T21:37:50Z")

</div>

Hi! I was trying to change the data type of a column, but failed.

1. Created a dataframe first:

```julia
using DataFrames
df = DataFrame(x = [1,2,3], y = ['a', 'b', 'c']);

```

1. Then tried changing the data type of y column from Char to Any:

```julia
df[!, :y] = convert.(Any, df[!,:y])

```

Instead of getting converted, received following output:

```julia
3-element Vector{Char}:
 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
 'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase)
 'c': ASCII/Unicode U+0063 (category Ll: Letter, lowercase)

```

Will be a great help if solution is posted.

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [March 18, 2022, 9:43pm UTC](https://discourse.julialang.org/t/cant-convert-columns-data-type-from-char-to-any/78111/2 "2022-03-18T21:43:17Z")

</div>

> [@janilin](#):
>
> ```julia
> df[!, :y] = convert.(Any, df[!,:y])
> 
> ```

How about

```julia
df[!, :y] = Vector{Any}(df[!,:y])

```

?

---

<div class="post-metadata">

**Author:** ![janilin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/janilin/32/33769_2.png) [@janilin](https://discourse.julialang.org/u/janilin)\
**Post date:** [March 18, 2022, 9:57pm UTC](https://discourse.julialang.org/t/cant-convert-columns-data-type-from-char-to-any/78111/3 "2022-03-18T21:57:10Z")

</div>

Ya, it worked! Thanks a lot for helping out!

---

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [March 19, 2022, 7:19am UTC](https://discourse.julialang.org/t/cant-convert-columns-data-type-from-char-to-any/78111/4 "2022-03-19T07:19:52Z")

</div>

Also `collect(Any, df.y)`.
