Hello Everyone:
I have performed a test,train split using:
train, test = partition(eachindex(Ponies), 0.8, shuffle = true)
Then, when I attempt to run a LinearRegressor as:
fm = @formula(Ponies ~ Headshots + Triples + Doubles)
linearRegressor = lm(fm, train)
I am getting the following error:
ArgumentError: expected data in a Table, got Vector{Int64}
The answer is not a simple 'convert(DataFrame, MagicalCreatureHeadshotDF)'
or DataFrame(MagicalCreatureHeadshotDF)
What I created after after train, test instructions looks like:
Is there a way to convert this structure to a dataframe?
Something like, MagicalCreatureHeadshotDF.reset_index()?
Thank you,
Well I don't know what Ponies
is, but train
should be a DataFrame with the columns Ponies
, Headshots
, Triples
, and Doubles
for your call to lm
to work.
Nils
Let's say, Ponies = rand(1: 0.01:15)
I agree -- however, the partition(eachindex(Ponies), 0.8, shuffle = true)
creates an array with two sub-indices (see image). How can I convert
these to a Table?
table = DataFrame(Ponies=rand(10), Headshots=rand(10))
And then partition the DataFrame.
Last updated: Nov 06 2024 at 04:40 UTC