LoadError: MethodError: Cannot `convert` an object

question

#1

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

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

#2

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.


#3

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 but don’t know how to download. could any one please help me out!


#4

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?


#5

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.