You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder if anything is wrong with this, I expected all to return (:x1, :x2). It crossed my mind that this could be an issue due to the source being a dataframe but I also tried a matrix table for X.
Thanks for this wonderful package!
The text was updated successfully, but these errors were encountered:
using DataFrames
using Tables
X = DataFrame(rand(Float64, 4, 2), :auto)
X_row = Tables.columns(Tables.rowtable(X))
println(Tables.columnnames(X_row))
X_dict_row = Tables.columns(Tables.dictrowtable(X))
println(Tables.columnnames(X_dict_row))
X_col = Tables.columntable(X)
println(Tables.columnnames(X_col))
After going through the docs, a table may only define one of Tables.columnnames(Table) or Tables.columnnames(row). Doesn't it seems natural for one to assume that the former should work for any table? In all cases, I wonder if one can know in advance whether they should do Tables.columnnames(Table) or Tables.columnnames(row) (i.e., whether the tables implements Tables.rows or Tables.columns)
Hi @EssamWisam, as you already discovered it, the Tables.columnnames can only be used safely in the result of Tables.columns and that is what we've been using ourselves too.
Perhaps the solution to this present issue is better documentation, e.g., FAQ.
I find that most new users bump eventually bump into this and are surprised. More importantly, the fact that unexpected behaviour is possible, as here, instead of an informative error (in case columnaccess is false) is unsatisfactory.
For instance,
yields
I wonder if anything is wrong with this, I expected all to return
(:x1, :x2)
. It crossed my mind that this could be an issue due to the source being a dataframe but I also tried a matrix table forX
.Thanks for this wonderful package!
The text was updated successfully, but these errors were encountered: