ERROR: LoadError: MethodError: no method matching getindex(::DataFrame, ::String)
Closest candidates are:
getindex(::DataFrame, !Matched::Symbol) at C:\Users\user.julia\packages\DataFrames\IKMvt\src\dataframe\dataframe.jl:252
getindex(::DataFrame, !Matched::Colon) at C:\Users\user.julia\packages\DataFrames\IKMvt\src\dataframe\dataframe.jl:264
getindex(::DataFrame, !Matched::Colon, !Matched::Colon) at C:\Users\user.julia\packages\DataFrames\IKMvt\src\dataframe\dataframe.jl:339
…
Stacktrace:
[1] read_data(::String, ::DataFrame, ::Int64, ::String) at F:\Kaggle\myreport.jl:10
[2] top-level scope at none:0
[3] include at .\boot.jl:326 [inlined]
[4] include_relative(::Module, ::String) at .\loading.jl:1038
[5] include(::Module, ::String) at .\sysimg.jl:29
[6] exec_options(::Base.JLOptions) at .\client.jl:267
[7] _start() at .\client.jl:436
in expression starting at F:\Kaggle\myreport.jl:31
This is my code
function read_data(typeData, labelsInfo, imageSize, path)
#Intialize x matrix
x = zeros(size(labelsInfo, 1), imageSize)
for (index, idImage) in enumerate(labelsInfo["ID"])
#Read image file
nameFile = "$(path)/$(typeData)Resized/$(idImage).Bmp"
img = load(nameFile)
temp = Gray.(img)
#Transform image matrix to a vector and store
#it in data matrix
x[index, :] = reshape(temp, 1, imageSize)
end
return x
end
imageSize = 400
path = "street-view-getting-started-with-julia"
labelsInfoTrain = CSV.read("$(path)/trainLabels.csv")
xTrain = read_data("train", labelsInfoTrain, imageSize, path)
labelsInfoTest = CSV.read("$(path)/sampleSubmission.csv")
xTest = read_data("test", labelsInfoTest, imageSize, path)