Skip to content

Commit 0ef2255

Browse files
committed
Implement Tables.jl interface for LabeledTable
1 parent 1dd1fef commit 0ef2255

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/StatsLearnModels.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
module StatsLearnModels
66

7-
using Tables
87
using Distances
98
using DataScienceTraits
109
using StatsBase: mode, mean
1110
using ColumnSelectors: ColumnSelector, selector
1211
using TableTransforms: StatelessFeatureTransform
1312

13+
import Tables
1414
import TableTransforms: applyfeat, isrevertible
1515

1616
using DecisionTree: AdaBoostStumpClassifier, DecisionTreeClassifier, RandomForestClassifier

src/labeledtable.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ function LabeledTable(table, names)
2323
LabeledTable{typeof(table)}(table, labs)
2424
end
2525

26+
Tables.istable(::Type{<:LabeledTable}) = true
27+
28+
Tables.rowaccess(::Type{<:LabeledTable{T}}) where {T} = Tables.rowaccess(T)
29+
30+
Tables.columnaccess(::Type{<:LabeledTable{T}}) where {T} = Tables.columnaccess(T)
31+
32+
Tables.rows(t::LabeledTable) = Tables.rows(t.table)
33+
34+
Tables.columns(t::LabeledTable) = Tables.columns(t.table)
35+
36+
Tables.columnnames(t::LabeledTable) = Tables.columnnames(t.table)
37+
2638
"""
2739
label(table, names)
2840

0 commit comments

Comments
 (0)