-
Notifications
You must be signed in to change notification settings - Fork 54
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
add nrow
and ncol
#124
Comments
I don't see a benefit to having this in Tables at the cost of adding more methods to the interface. |
Is the canonical recommendation to do this |
Works because many iterators has the has length traits |
To expand, "most" tables in practice have a length, but the Tables interface doesn't guarantee it. This is what I would do to get t = Tables.columns(df)
nrows = length(first(t))
ncols = length(t) t2 = Tables.rows(df)
nrows = length(t2)
ncols = length(first(t2)) |
Thanks for the note. Just to be clear, the iteration itself is determined by I was under the impression iteration was implemented by
|
Also your second example doesn't work for generic tables because iteration on rows isn't defined, even as a fallback. Ref #75 |
Correct. A DataFrame probably has
Iteration over a single row isn't guaranteed, but |
https://docs.julialang.org/en/v1/manual/interfaces/ There is an IteratorSize() type checker and the default is |
You can get the number of columns from julia> using Tables
julia> X = (x1=rand(3), x2=rand(3))
(x1 = [0.893945, 0.696079, 0.544089],
x2 = [0.162807, 0.0328988, 0.567906],)
julia> length(Tables.schema(X).names)
2 |
I think there have been enough clarifications and suggestions here; but yeah, I dont' think we need anything in the interface for this. |
No description provided.
The text was updated successfully, but these errors were encountered: