# Getting this error Message MethodError: no method matching getindex(::DataFrame, ::String) but method is there (I m trying to do the kaggle dataset "https://www.kaggle.com/c/street-view-getting-started-with-julia/overview" )

**URL:** <https://discourse.julialang.org/t/getting-this-error-message-methoderror-no-method-matching-getindex-dataframe-string-but-method-is-there-i-m-trying-to-do-the-kaggle-dataset-https-www-kaggle-com-c-street-view-getting-started-with-julia-overview/22890>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [April 7, 2019, 8:33pm UTC](https://discourse.julialang.org/t/getting-this-error-message-methoderror-no-method-matching-getindex-dataframe-string-but-method-is-there-i-m-trying-to-do-the-kaggle-dataset-https-www-kaggle-com-c-street-view-getting-started-with-julia-overview/22890 "2019-04-07T20:33:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nishant\_Balayan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nishant_balayan/32/7851_2.png) [@Nishant\_Balayan](https://discourse.julialang.org/u/Nishant_Balayan)\
**Post date:** [April 7, 2019, 8:33pm UTC](https://discourse.julialang.org/t/getting-this-error-message-methoderror-no-method-matching-getindex-dataframe-string-but-method-is-there-i-m-trying-to-do-the-kaggle-dataset-https-www-kaggle-com-c-street-view-getting-started-with-julia-overview/22890/1 "2019-04-07T20:33:49Z")

</div>

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

```julia
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)

```

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [April 8, 2019, 12:00am UTC](https://discourse.julialang.org/t/getting-this-error-message-methoderror-no-method-matching-getindex-dataframe-string-but-method-is-there-i-m-trying-to-do-the-kaggle-dataset-https-www-kaggle-com-c-street-view-getting-started-with-julia-overview/22890/2 "2019-04-08T00:00:33Z")

</div>

Welcome to the forums! Please take a look at [this post](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757), and follow it’s guidelines to help us help you. Simply posting an error message without context is unlikely to solicit much help.

---

<div class="post-metadata">

**Author:** ![Nishant\_Balayan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nishant_balayan/32/7851_2.png) [@Nishant\_Balayan](https://discourse.julialang.org/u/Nishant_Balayan)\
**Post date:** [April 8, 2019, 4:42am UTC](https://discourse.julialang.org/t/getting-this-error-message-methoderror-no-method-matching-getindex-dataframe-string-but-method-is-there-i-m-trying-to-do-the-kaggle-dataset-https-www-kaggle-com-c-street-view-getting-started-with-julia-overview/22890/3 "2019-04-08T04:42:21Z")

</div>

sorry, for that but now I have updated my Query

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [April 8, 2019, 10:49am UTC](https://discourse.julialang.org/t/getting-this-error-message-methoderror-no-method-matching-getindex-dataframe-string-but-method-is-there-i-m-trying-to-do-the-kaggle-dataset-https-www-kaggle-com-c-street-view-getting-started-with-julia-overview/22890/4 "2019-04-08T10:49:46Z")

</div>

No worries! You should also quote your code with 3 backticks:

````julia
```
foo(x) = x + 2

y = foo(42)
```

````
