# Has the categorical! function in DataFrames.jl been relegated?

**URL:** <https://discourse.julialang.org/t/has-the-categorical-function-in-dataframes-jl-been-relegated/97196>\
**Category:** Data\
**Tags:** dataframes\
**Created:** [April 6, 2023, 9:23pm UTC](https://discourse.julialang.org/t/has-the-categorical-function-in-dataframes-jl-been-relegated/97196 "2023-04-06T21:23:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rud-lucien](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rud-lucien/32/38576_2.png) [@rud-lucien](https://discourse.julialang.org/u/rud-lucien)\
**Post date:** [April 6, 2023, 9:23pm UTC](https://discourse.julialang.org/t/has-the-categorical-function-in-dataframes-jl-been-relegated/97196/1 "2023-04-06T21:23:26Z")

</div>

Hi,

I was looking around for a quick way to convert columns of data in a DataFrame into categorical data and found and example in this [link](https://docs.juliahub.com/DataFrames/AR9oZ/0.21.8/man/categorical/). However, when I tried it in my REPL, it didn’t work. Just wondering if this function was relegate or something. See my REPL code below.

> julia\> versioninfo()  
> Julia Version 1.9.0-rc2  
> Commit 72aec423c2 (2023-04-01 10:41 UTC)  
> Platform Info:  
> OS: Windows (x86\_64-w64-mingw32)  
> CPU: 20 × 12th Gen Intel(R) Core™ i7-12800H  
> WORD\_SIZE: 64  
> LIBM: libopenlibm  
> LLVM: libLLVM-14.0.6 (ORCJIT, alderlake)  
> Threads: 1 on 20 virtual cores

> julia\> df = DataFrame(A = [“A”, “B”, “C”, “D”, “D”, “A”],  
> B = [“X”, “X”, “X”, “Y”, “Y”, “Y”])  
> 6×2 DataFrame  
> Row │ A B  
> │ String String  
> ─────┼────────────────  
> 1 │ A X  
> 2 │ B X  
> 3 │ C X  
> 4 │ D Y  
> 5 │ D Y  
> 6 │ A Y

> julia\> categorical!(df, :A)  
> ERROR: UndefVarError: `categorical!` not defined  
> Stacktrace:  
> [1] top-level scope @ REPL[16]:1

> julia\> categorical!(df, :B)  
> ERROR: UndefVarError: `categorical!` not defined  
> Stacktrace:  
> [1] top-level scope @ REPL[17]:1

---

<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:** [April 7, 2023, 1:18pm UTC](https://discourse.julialang.org/t/has-the-categorical-function-in-dataframes-jl-been-relegated/97196/2 "2023-04-07T13:18:18Z")

</div>

see [UndefVarError: categorical! in Julia](https://discourse.julialang.org/t/undefvarerror-categorical-in-julia/97160)

---

<div class="post-metadata">

**Author:** ![rud-lucien](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rud-lucien/32/38576_2.png) [@rud-lucien](https://discourse.julialang.org/u/rud-lucien)\
**Post date:** [April 7, 2023, 1:23pm UTC](https://discourse.julialang.org/t/has-the-categorical-function-in-dataframes-jl-been-relegated/97196/3 "2023-04-07T13:23:50Z")

</div>

Thanks for the help @bkamins!
