Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error printing a Vector{NamedTuple} #27747

Closed
yurivish opened this issue Jun 23, 2018 · 3 comments
Closed

Error printing a Vector{NamedTuple} #27747

yurivish opened this issue Jun 23, 2018 · 3 comments
Assignees

Comments

@yurivish
Copy link
Contributor

yurivish commented Jun 23, 2018

julia> x = (year = 2012, name = "pancho", gender = :m, breed = "chihuahua", borough = "queens", zip = "11358", issued = 2011-06-11, expired = 2012-06-11, vector = [-0.0178, 0.0398, 0.0632, 0.063, 0.0181, 0.0617, 0.0578, 0.0089, -0.0245, 0.0026,  0.0032, -0.0484, 0.0236, 0.0672, -0.0312, 0.0232, 0.0571, 0.0216, -0.0301, -0.0371], size = "small", group = "akc toy");

julia> [x, x]
2-element Array{NamedTuple{(:year, :name, :gender, :breed, :borough, :zip, :issued, :expired, :vector, :size, :group),Tuple{Int64,String,Symbol,String,String,String,Int64,Int64,Array{Float64,1},String,String}},1}:
Error showing value of type Array{NamedTuple{(:year, :name, :gender, :breed, :borough, :zip, :issued, :expired, :vector, :size, :group),Tuple{Int64,String,Symbol,String,String,String,Int64,Int64,Array{Float64,1},String,String}},1}:
ERROR: AssertionError: Array{Float64,1} is not a subtype of NamedTuple{(:year, :name, :gender, :breed, :borough, :zip, :issued, :expired, :vector, :size, :group),Tuple{Int64,String,Symbol,String,String,String,Int64,Int64,Array{Float64,1},String,String}}
Stacktrace:
 [1] typeinfo_prefix(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Array{Float64,1}) at ./arrayshow.jl:477
 [2] show_vector(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Array{Float64,1}, ::Char, ::Char) at ./arrayshow.jl:431 (repeats 2 times)
 [3] show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Array{Float64,1}) at ./arrayshow.jl:417
 [4] show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::NamedTuple{(:year, :name, :gender, :breed, :borough, :zip, :issued, :expired, :vector, :size, :group),Tuple{Int64,String,Symbol,String,String,String,Int64,Int64,Array{Float64,1},String,String}}) at ./namedtuple.jl:142
 [5] #sprint#336(::IOContext{REPL.Terminals.TTYTerminal}, ::Int64, ::Function, ::Function, ::NamedTuple{(:year, :name, :gender, :breed, :borough, :zip, :issued, :expired, :vector, :size, :group),Tuple{Int64,String,Symbol,String,String,String,Int64,Int64,Array{Float64,1},String,String}}) at ./strings/io.jl:97
 [6] #sprint at ./array.jl:0 [inlined]
 [7] alignment at ./show.jl:1780 [inlined]
 [8] alignment(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{NamedTuple{(:year, :name, :gender, :breed, :borough, :zip, :issued, :expired, :vector, :size, :group),Tuple{Int64,String,Symbol,String,String,String,Int64,Int64,Array{Float64,1},String,String}},1}, ::Base.OneTo{Int64}, ::Base.OneTo{Int64}, ::Int64, ::Int64, ::Int64) at ./arrayshow.jl:68
 [9] print_matrix(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{NamedTuple{(:year, :name, :gender, :breed, :borough, :zip, :issued, :expired, :vector, :size, :group),Tuple{Int64,String,Symbol,String,String,String,Int64,Int64,Array{Float64,1},String,String}},1}, ::String, ::String, ::String, ::String, ::String, ::String, ::Int64, ::Int64) at ./arrayshow.jl:186
...

julia> versioninfo()
Julia Version 0.7.0-alpha.59
Commit 2a45839ef9* (2018-06-09 17:04 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin16.7.0)
  CPU: Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, ivybridge)
Environment:
  JULIA_EDITOR = subl
@yurivish yurivish changed the title Error printing NamedTuple Error printing a Vector{NamedTuple} Jun 23, 2018
@JeffBezanson
Copy link
Sponsor Member

Duplicate of #26881

@JeffBezanson JeffBezanson marked this as a duplicate of #26881 Jun 23, 2018
@yurivish
Copy link
Contributor Author

Hah, sorry – that previous issue was also mine. I didn't realize this was the same thing.

@rfourquet
Copy link
Member

Actually not a duplicate, assiging myself here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants