New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
map no longer relies on inference #137
Conversation
Note that with the new IndexedTables._map(i ->@NT(sum = i.x+i.y, diff = i.x-i.y), Iterators.filter(f, t)) (we should maybe rename or equivalently collect_columns(@NT(sum = i.x+i.y, diff = i.x-i.y) for i in t if f(i)) which is a nice Pinging @davidanthoff on this one as I think it was one of his ideas to start implementing this kind of syntax. |
Even better, we could consider defining |
What happens when table is called with a tuple or named tuple of vectors then? Tuples are iterable too |
Hehe, this is starting to look more and more like Query.jl ;) Which really is nothing other than chained lazy iterators for everything (at least for the one backend we have right now). About the I think you should be able right now to just replace the whole function body with the following and it probably will just work with the whole iterable tables machinery: function table(iter; kwargs...)
return table(collect_columns(IteratorInterfaceExtensions.getiterator(iter)); kwargs...)
end I haven't tried that, but I think the designs are essentially equivalent, so I'm optimistic it will just work. The motivation for the Things might get a bit more complicated if IndexedTables moves over to I'm also in the process of adding two more interfaces to TableTraits.jl. Both of them are described in http://www.david-anthoff.com/jl4ds/latest/tabletraits.html. For now they should make certain scenarios much faster (initially probably mostly the file IO story, but we'll have to see). Eventually it might make sense to add support for those to the |
@shashi the method to collect an iterable would be the one with the lowest dispatch preference, so it won't affect other methods. We may even consider whether we want a @davidanthoff the two advantages I see for the change are:
Nice job on the column based interface, we should definitely support it, it seems very useful also for IndexedTables to DataFrames conversion. Feel free to copy paste this code (or change as needed) for IterableTables. |
I've added the julia> map_rows(tuple, 1:3, ["a","b","c"])
3-element Columns{Tuple{Int64,String}}:
(1, "a")
(2, "b")
(3, "c") I think it may come in handy later for Should be good to go on my side, I'll do the |
@davidanthoff For the |
🚀 |
Oh, missed this question. Yes, IteratorInterfaceExtensions.jl is stable, I don't see any changes for that coming. |
I've addressed the last issues from #135 (allowing the user to give a mix of
NamedTuples
with different fields that gets stored asVector{NamedTuples}
) and updatemap
to use the newcollect_columns
.