Closed akdor1154 closed 3 years ago
It looks like nested Pair
s are required to hit the correct method. Using Pair{Symbol, AnythingThatIsNotPair}
attempts to call the second argument (selection type 3). There's a missing method somewhere.
Here's a workaround:
select(table, (:Name => :OldName => identity,))
I'm using the following overload as a workaround:
function IndexedTables.select(table::IndexedTable, selection::Tuple{Vararg{Pair{Symbol, <:Any}}})
names = [fst for (fst, snd) in selection] |> Base.splat(tuple)
cols = [snd for (fst, snd) in selection] |> Base.splat(tuple)
selected = IndexedTables.select(table, cols)
renameList = (zip(colnames(selected), names) .|> Base.splat(Pair))
return IndexedTables.rename(selected, renameList...)
end
If you can point me towards where the missing method should be, I'd have a play with a PR to fix this. I found it difficult to work out where it should go though - e.g. getindex on a ColDict?
Trying to use
select(table, (:Name => ::Selection,))
does not seem to work as per my interpretation of the docs. From the documentation:As per this, I would expect to be able to select columns under a new name using
select
. E.g. If I callselect(table, (:Name => :OldName,))
, as this satisfies the typeTuple{Pair{Symbol, Selection}}
. Is this meant to work?