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
Based on the "Dendrograms" section of the tests, and a cursory look at the source for subset, it seems that the following should work, but currently error:
Tables.subset(td.X,1) # works
Tables.subset(td.X,2)
# do not work
Tables.subset(td.X,1:2)
Tables.subset(td.X,[1,2])
Tables.subset(td.X,:)
I plan to look into this soon.
The text was updated successfully, but these errors were encountered:
@epatters not sure if this solution is too janky. The issue is that we need Tables.schema to work on objects of type ACSetTable. Anyway, this works.
using ACSets
using Tables
SchDendrogram =BasicSchema([:X], [(:parent,:X,:X)], [:R], [(:height,:X,:R)])
@abstract_acset_type AbstractDendrogram
@acset_typeDendrogram(SchDendrogram, index=[:parent]) <:AbstractDendrogram
d =Dendrogram{Int}()
add_parts!(d, :X, 3, height=0)
add_parts!(d, :R, 2)
add_parts!(d, :X, 2, height=[10,AttrVar(add_part!(d,:R))])
set_subpart!(d, 1:3, :parent, 4)
set_subpart!(d, [4,5], :parent, 5)
td =tables(d)
Tables.subset(td.X,1)
Tables.subset(td.X,2)
Tables.subset(td.X,1:2)
# need to be able to get a Tables.Schema out of an ACSetTable objimport Tables: schema
function Tables.schema(tab::ACSets.DenseACSets.ACSetTable)
names = Tables.columnnames(tab)
Tables.Schema(names, [typeof(getindex(tab,name)) for name in names])
end
Tables.subset(td.X,1:2)
Tables.subset(td.X,[1,2])
Tables.subset(td.X,:)
[EDIT] Actually this might be a subpar solution, as now Tables.subset returns a different data type than an ACSetTable (returns a Tables.DictColumnTable, see https://github.com/JuliaData/Tables.jl/blob/25be9d246c2d9e0f31f694476164631d3e4f7b52/src/Tables.jl#L608). I'm guessing the spirit of ACSets.jl would be instead to extend the method Tables.subset directly. What do you think? Happy to get a PR doing that. In that case, do we also still want to extend Tables.schema as well?
Based on the "Dendrograms" section of the tests, and a cursory look at the source for
subset
, it seems that the following should work, but currently error:I plan to look into this soon.
The text was updated successfully, but these errors were encountered: