-
Notifications
You must be signed in to change notification settings - Fork 38
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
Tables.jl interface and iterators #174
Comments
Hi @trulsf ! I maybe wrong, but check the documentation of Tables.jl if you have row-access:
Hence, in
If you replace the line:
by
Does it work? |
As far as I understand it there is no requirement on an iterator compatible with
|
So, how can we take the element in the ith row and jth column to print the table? |
I am no expert on these matters, so it may be worthwhile to check out with the Tables.jl people what is the proper way of getting a specific row. In principle, I do not think that Tables.jl allows for indexing. I guess a possibility is to use |
Hi @trulsf ! I think I discovered the problem. Your data assumes that the initial state is 0 instead of 1. Hence, PrettyTables.jl is trying to obtain an element that does not exist. I agree that, in this case, I cannot assume the initial state is 1. I modified this part to obtain the i-th row by iterating i times. Can you please test against |
Works for me on master, thanks @ronisbr |
Perfect! I should release a new version after I finish the PR to use HTML backend in DataFrames.jl. |
State can be anything, but Tables.jl table should support
|
Ah! I see, so the object should implement |
I have implemented the Tables.jl interface for some solution structures from JuMP. This seems to work well for most applications (e.g. CSV, databases etc.), but we run into problems with PrettyTables.jl.
The problem seems to reside with the fact that PrettyTables seems to assume that the iterator for the rows access of the table uses the row number as state. As far as I understand the Tables.jl interface there is no requirement that the iterator must be implemented with the row number as the state. In my case the iterator state is e.g. a CartesianIndex into an array.
The code in question is in tables.jl (lines 79 and 100):
Is this a correct observation? Any possibilities of having PrettyTables working with more general iterators?
The text was updated successfully, but these errors were encountered: