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

Compatibility with PrettyTables.jl #15

Closed
hellemo opened this issue Jul 18, 2022 · 2 comments
Closed

Compatibility with PrettyTables.jl #15

hellemo opened this issue Jul 18, 2022 · 2 comments

Comments

@hellemo
Copy link
Member

hellemo commented Jul 18, 2022

After example from Readme:

using PrettyTables
pretty_table(tab)
ERROR: MethodError: no method matching iterate(::Nothing)
Closest candidates are:
  iterate(::Union{LinRange, StepRangeLen}) at range.jl:872
  iterate(::Union{LinRange, StepRangeLen}, ::Integer) at range.jl:872
  iterate(::T) where T<:Union{Base.KeySet{<:Any, <:Dict}, Base.ValueIterator{<:Dict}} at dict.jl:712

Workaround via DataFrame:

pretty_table(DataFrame(tab))
┌────────┬───────┬─────────┐
│    car │  year │       y │
│ String │ Int64 │ Float64 │
├────────┼───────┼─────────┤
│    bmw │  2001 │     0.0 │
│   ford │  2001 │     0.0 │
│   ford │  2000 │     0.0 │
│    bmw │  2002 │     0.0 │
└────────┴───────┴─────────┘
@trulsf
Copy link
Member

trulsf commented Aug 4, 2022

I have had a look into it and the problem seems to be that PrettyTables.jl assumes an iterate function that uses the row number as state. I have opened an issue to discuss it there: ronisbr/PrettyTables.jl#174

Not too hard to fix, but will then require either some internal storage of all indices or some cumbersome details. I would preferably see if there is hope for a change in PrettyTables.

@hellemo
Copy link
Member Author

hellemo commented Aug 9, 2022

Works on PrettyTables#master

@hellemo hellemo closed this as completed Aug 9, 2022
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

2 participants