UndefVarError: categorical! in Julia

i am using julia version1.8.5. I define a variable "geordd_df“ with DataFrame function. There is a ”UndefVarError: categorical! not defined“ when i run “categorical!(geordd_df, :categ)” in julia

. can anyone help?

The reason you get this error is that there is no categorical! function defined.

You can do e.g.:

using CategoricalArrays
geordd_df.categ = categorical(geordd_df.categ)


using CategoricalArrays
transform!(geordd_df, :categ => categorical => :categ)


@bkamins Thanks a lot for your quick response. The second method works well.