Skip to content

Commit

Permalink
cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
OkonSamuel authored Jun 10, 2022
1 parent 7f0f2fd commit ca69c2f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/interface/data_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,17 @@ function MMI.selectrows(::FI, ::Val{:table}, X, r)
end

function MMI.selectcols(::FI, ::Val{:table}, X, c::Union{Symbol, Integer})
if !isdataframe(X)
cols = Tables.columns(X)
return Tables.getcolumn(cols, c)
else
return X[!, c]
end
cols = Tables.columns(X)
return Tables.getcolumn(cols, c)
end

function MMI.selectcols(::FI, ::Val{:table}, X, c::Union{Colon, AbstractArray})
if !isdataframe(X)
if isdataframe(X)
return X[!, c]
else
cols = Tables.columntable(X) # named tuple of vectors
newcols = project(cols, c)
return Tables.materializer(X)(newcols)
else
return X[!, c]
end
end

Expand Down

0 comments on commit ca69c2f

Please sign in to comment.