Re: [julia-users] Re: How to find the index of array containing some text (substring)
I think you need parse, instead of convert, for these cases. On Wednesday, July 8, 2015 at 2:41:01 PM UTC-4, paul analyst wrote: > > thx, bat no:) > In my array are digits too. I must Some loop to preapere . > Paul > > julia> A2 = map( (x)->convert(ASCIIString,x), A) > ERROR: `convert` has no method matching convert(::Type{ASCIIString}, > ::Float64) > in convert at base.jl:13 > in anonymous at none:1 > in map at base.jl:189 > > > W dniu 2015-07-08 o 20:35, Eduardo Lenz pisze: > > > > A2 = map( (x)->convert(ASCIIString,x), A) > >
Re: [julia-users] Re: How to find the index of array containing some text (substring)
julia> A2 = map( (x)->convert(ASCIIString, string(x)), A) ERROR: invalid ASCII sequence in convert at ascii.jl:101 in bytestring at string.jl:644 in convert at ascii.jl:120 in anonymous at none:1 in map at base.jl:189 But after readcsv(file, UTF8 String) works! THX Paul W dniu 2015-07-08 o 20:46, Eduardo Lenz pisze: A2 = map( (x)->convert(ASCIIString, string(x)), A)
Re: [julia-users] Re: How to find the index of array containing some text (substring)
if i read data like String is ok , but is problem with digit:) data=readcsv("file.txt",UTF8String) Paweł W dniu 2015-07-08 o 20:40, Paul Analyst pisze: thx, bat no:) In my array are digits too. I must Some loop to preapere . Paul julia> A2 = map( (x)->convert(ASCIIString,x), A) ERROR: `convert` has no method matching convert(::Type{ASCIIString}, ::Float64) in convert at base.jl:13 in anonymous at none:1 in map at base.jl:189 W dniu 2015-07-08 o 20:35, Eduardo Lenz pisze: A2 = map( (x)->convert(ASCIIString,x), A)
Re: [julia-users] Re: How to find the index of array containing some text (substring)
My last atempt :0) A2 = map( (x)->convert(ASCIIString, string(x)), A) good luck ! On Wednesday, July 8, 2015 at 3:41:01 PM UTC-3, paul analyst wrote: > > thx, bat no:) > In my array are digits too. I must Some loop to preapere . > Paul > > julia> A2 = map( (x)->convert(ASCIIString,x), A) > ERROR: `convert` has no method matching convert(::Type{ASCIIString}, > ::Float64) > in convert at base.jl:13 > in anonymous at none:1 > in map at base.jl:189 > > > W dniu 2015-07-08 o 20:35, Eduardo Lenz pisze: > > > > A2 = map( (x)->convert(ASCIIString,x), A) > >
Re: [julia-users] Re: How to find the index of array containing some text (substring)
thx, bat no:) In my array are digits too. I must Some loop to preapere . Paul julia> A2 = map( (x)->convert(ASCIIString,x), A) ERROR: `convert` has no method matching convert(::Type{ASCIIString}, ::Float64) in convert at base.jl:13 in anonymous at none:1 in map at base.jl:189 W dniu 2015-07-08 o 20:35, Eduardo Lenz pisze: A2 = map( (x)->convert(ASCIIString,x), A)
Re: [julia-users] Re: How to find the index of array containing some text (substring)
Maybe A2 = map( (x)->convert(ASCIIString,x), A) and then f = Bool[contains("b",i) for i in A2] or f = Bool[contains("b",convert(ASCIIString,i) for i in A] Strings are not my speciality :0) On Wednesday, July 8, 2015 at 3:26:42 PM UTC-3, paul analyst wrote: > > Big Thx , but "b",i in oposit order must like below... i,"b" > > But my aray is 2261-element Array{Any,1}: , the trick working only > with Array{ASCIIString,1}: , How convert Array Any to Array ASCIIString ? > > julia> [contains("b",i) for i in A] > 4-element Array{Any,1}: > false > false > false > false > > julia> A > 4-element Array{ASCIIString,1}: > "aaa" > "aab" > "aac" > "aba" > > > julia> [contains(i,"b") for i in A] > 4-element Array{Any,1}: > false >true > false >true > > W dniu 2015-07-08 o 19:58, Eduardo Lenz pisze: > > [contains("b",i) for i in A] > >
[julia-users] Re: How to find the index of array containing some text (substring)
Improving the answer f = Bool[contains("b",i) for i in A] susch that A[f] returns "aab" and "aba". Hope it helps. On Wednesday, July 8, 2015 at 2:58:43 PM UTC-3, Eduardo Lenz wrote: > > Hi > >[contains("b",i) for i in A] > > should do the trick. > > On Wednesday, July 8, 2015 at 2:26:12 PM UTC-3, paul analyst wrote: >> >> Is array A >> julia> A=["aaa","aab","aac","aba"] >> 4-element Array{ASCIIString,1}: >> "aaa" >> "aab" >> "aac" >> "aba" >> >> How to How to find the index this arrary containing "b" ? >> >> >> julia> find(A,"b") >> ERROR: `find` has no method matching find(::Array{ASCIIString,1}, >> ::ASCIIString) >> >> julia> getindex(A,"b") >> ERROR: `getindex` has no method matching getindex(::Array{ASCIIString,1}, >> ::ASCIIString) >> >> julia> search(A,"b") >> ERROR: `search` has no method matching search(::Array{ASCIIString,1}, >> ::ASCIIString) >> >> julia> search(A,"b") >> ERROR: `search` has no method matching search(::Array{ASCIIString,1}, >> ::ASCIIString) >> >> >> Paul >> >
Re: [julia-users] Re: How to find the index of array containing some text (substring)
Big Thx , but "b",i in oposit order must like below... i,"b" But my aray is 2261-element Array{Any,1}: , the trick working only with Array{ASCIIString,1}: , How convert Array Any to Array ASCIIString ? julia> [contains("b",i) for i in A] 4-element Array{Any,1}: false false false false julia> A 4-element Array{ASCIIString,1}: "aaa" "aab" "aac" "aba" julia> [contains(i,"b") for i in A] 4-element Array{Any,1}: false true false true W dniu 2015-07-08 o 19:58, Eduardo Lenz pisze: [contains("b",i) for i in A]
[julia-users] Re: How to find the index of array containing some text (substring)
Hi [contains("b",i) for i in A] should do the trick. On Wednesday, July 8, 2015 at 2:26:12 PM UTC-3, paul analyst wrote: > > Is array A > julia> A=["aaa","aab","aac","aba"] > 4-element Array{ASCIIString,1}: > "aaa" > "aab" > "aac" > "aba" > > How to How to find the index this arrary containing "b" ? > > > julia> find(A,"b") > ERROR: `find` has no method matching find(::Array{ASCIIString,1}, > ::ASCIIString) > > julia> getindex(A,"b") > ERROR: `getindex` has no method matching getindex(::Array{ASCIIString,1}, > ::ASCIIString) > > julia> search(A,"b") > ERROR: `search` has no method matching search(::Array{ASCIIString,1}, > ::ASCIIString) > > julia> search(A,"b") > ERROR: `search` has no method matching search(::Array{ASCIIString,1}, > ::ASCIIString) > > > Paul >