# LoadError: MethodError: Cannot \`convert\` an object

**URL:** https://discourse.julialang.org/t/loaderror-methoderror-cannot-convert-an-object/1761
**Category:** General Usage
**Tags:** question
**Created:** [January 29, 2017, 1:26pm UTC](https://discourse.julialang.org/t/loaderror-methoderror-cannot-convert-an-object/1761 "2017-01-29T13:26:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rushirg](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rushirg](https://discourse.julialang.org/u/rushirg)
#### Post date: [January 29, 2017, 1:26pm UTC](https://discourse.julialang.org/t/loaderror-methoderror-cannot-convert-an-object/1761/1 "2017-01-29T13:26:42Z")

</div>

i am getting error like this:  
**ERROR:** LoadError: MethodError: Cannot `convert` an object of type DataArrays.DataArray{Any,1} to an object of type Int32  
This may have arisen from a call to the constructor Int32(…),

As, i am trying to convert a character matrix to int as below

```julia
yTrain = map(x -> x[1], labelsInfoTrain[2])
yTrain = Int(yTrain) #error on this line

```

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [January 29, 2017, 3:43pm UTC](https://discourse.julialang.org/t/loaderror-methoderror-cannot-convert-an-object/1761/2 "2017-01-29T15:43:03Z")

</div>

It is unclear how a (general) vector of characters (note that it is not a matrix, but a vector) would map to an integer. Are they digits, to be concatenated? A minimal working example would help.

---

<div class="post-metadata">

### Author: ![rushirg](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rushirg](https://discourse.julialang.org/u/rushirg)
#### Post date: [February 12, 2017, 12:58pm UTC](https://discourse.julialang.org/t/loaderror-methoderror-cannot-convert-an-object/1761/3 "2017-02-12T12:58:52Z")

</div>

Also, is there any Julia **version problem** as currently i am having version **0.5.0** and one of my friend is having **0.3.11** and on his machine the same code works fine!

if there is how can i download previous release of Julia, i found the official website [http://julialang.org/downloads/oldreleases.html](http://julialang.org/downloads/oldreleases.html) but don’t know how to download. could any one please help me out!

---

<div class="post-metadata">

### Author: ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)
#### Post date: [February 12, 2017, 7:42pm UTC](https://discourse.julialang.org/t/loaderror-methoderror-cannot-convert-an-object/1761/4 "2017-02-12T19:42:53Z")

</div>

As @Tamas_Papp said, it’s hard for us to help you because we don’t know what you want that code to do. What are the contents of `yTrain` before the error? And what do you want them to be afterwards?

---

<div class="post-metadata">

### Author: ![rushirg](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rushirg](https://discourse.julialang.org/u/rushirg)
#### Post date: [February 14, 2017, 6:17pm UTC](https://discourse.julialang.org/t/loaderror-methoderror-cannot-convert-an-object/1761/5 "2017-02-14T18:17:46Z")

</div>

I am doing image processing in Julia, so basically i am having variables like as below:  
1 . ` labelsInfoTrain = readtable(file_name.csv)` this reads information from file containing 2 values ID and value

2 . ` xTrain = read_data("train", labelsInfoTrain, imageSize, pathOfDirectory)` xTrain is matrix which reads my training matrix, imagesize is integer, '“train” is just a string.

3 .`yTrain = map(x -> x[1], labelsInfoTrain[2])` this get only first character of string (convert from string to character) and this is applied to each second element in labelsInfoTrain.

and after that i am converting that character to int as  
`yTrain = int(yTrain)`

And Error is like below:

`ERROR: LoadError: type Array has no field data in read_data(::String, ::DataFrames.DataFrame, ::Int32, ::String)` at .jl file location.
