# Lathe.jl: No Method Matching Error

**URL:** <https://discourse.julialang.org/t/lathe-jl-no-method-matching-error/65455>\
**Category:** Modelling & Simulations\
**Created:** [July 28, 2021, 6:41pm UTC](https://discourse.julialang.org/t/lathe-jl-no-method-matching-error/65455 "2021-07-28T18:41:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![YummyPampers2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yummypampers2/32/27328_2.png) [@YummyPampers2](https://discourse.julialang.org/u/YummyPampers2)\
**Post date:** [July 28, 2021, 6:41pm UTC](https://discourse.julialang.org/t/lathe-jl-no-method-matching-error/65455/1 "2021-07-28T18:41:48Z")

</div>

Hello Everyone:

I am using Lathe:preprocess

Have attempted to activate the  
following functions from [HERE](https://github.com/emmettgb/Lathe.jl/blob/master/src/preprocess/encoding.jl):

```julia
begin
	mutable struct OneHotEncoder{P} <: Lathe.preprocess.Encoder
	    predict::P
	    function OneHotEncoder()
	        predict(df::DataFrame, symb::Symbol) = _onehot(df, symb)
	        P = typeof(predict)
	        return new{P}(predict)
	    end
	end
end

```

No function return message, but no error

Then,

```julia
begin
function _onehot(df,symb)
	    copy = df
	    for c in unique(copy[!,symb])
	        copy[!,Symbol(c)] = copy[!,symb] .== c
	    end
	    return(copy)
	end
end

```

Returning ‘\_onehot (generic function with 1 method)’

I am encountering an error when I attempt to implement:

```julia
        Lathe.preprocess.OneHotEncoder(CoDMW, "HeadShots")
	Lathe.preprocess.OneHotEncoder(CodMW, "Injuries")
	Lathe.preprocess.OneHotEncoder(CodMW, "SharedHits")

```

But I am encountering the following error:

```julia
MethodError: no method matching Lathe.preprocess.OneHotEncoder(::DataFrames.DataFrame, ::String)

```

When I replace the method with \_onehot I get  
new columns with the categorical values as  
the column names, and the row values as Bool  
types.

Is there a reason why the first function is not recognized?

Thank you.
