View Source DataframeTools.String (Dataframe Tools v0.2.1)

Summary

Functions

Converts all string columns in a DataFrame to categories where n_unique items < half total items. This is just a way to make more efficient use of memory and faster joins.

Functions

Converts all string columns in a DataFrame to categories where n_unique items < half total items. This is just a way to make more efficient use of memory and faster joins.

Examples

iex> df = Explorer.DataFrame.new(%{
...>   names: Explorer.Series.from_list(~w(bob bob bob harry tom tom harry bob bob bob)),
...>   unique_names: Explorer.Series.from_list(~w(a bcob c d e f g h i j))
...> })
iex> df2 = DataframeTools.String.categorise_columns(df)
iex> Explorer.DataFrame.dtypes(df2)
%{"names" => :category, "unique_names" => :string}