RE: [julia-users] Filtering DataFrame with a function

2016-10-13 Thread Júlio Hoffimann
That is really cool David, I fully agree with this modularization :) -Júlio

RE: [julia-users] Filtering DataFrame with a function

2016-10-13 Thread David Anthoff
...@gmail.com] On Behalf Of Jacob Quinn Sent: Wednesday, October 12, 2016 11:14 PM To: julia-users@googlegroups.com Subject: Re: [julia-users] Filtering DataFrame with a function I think the Julia ecosystem is evolving tremendously in this respect. I think originally, there were a lot

Re: [julia-users] Filtering DataFrame with a function

2016-10-13 Thread Júlio Hoffimann
Hi Alex, That is closer to what I had in mind originally, but I actually solved the problem by reorganizing my algorithm to avoid filters. Thank you, -Júlio 2016-10-13 8:21 GMT-07:00 Alex Mellnik : > Hi Júlio, > > If you're just interested in using an arbitrary function

Re: [julia-users] Filtering DataFrame with a function

2016-10-13 Thread Alex Mellnik
Hi Júlio, If you're just interested in using an arbitrary function to filter on rows you can do something like: df = DataFrame(Fish = ["Amir", "Betty", "Clyde"], Mass = [1.2, 3.3, 0.4]) filter(row) = (row[:Fish][1] != "A")&(row[:Mass]>1) df = df[[filter(r) for r in eachrow(df)],:] Is that what

Re: [julia-users] Filtering DataFrame with a function

2016-10-13 Thread Jacob Quinn
I think the Julia ecosystem is evolving tremendously in this respect. I think originally, there were a lot of these "mammoth" packages that tried to provide everything and the kitchen sink. Unfortunately, this has led to package bloat, package inefficiencies in terms of load times and

Re: [julia-users] Filtering DataFrame with a function

2016-10-12 Thread Júlio Hoffimann
Thank you very Much David, these queries you showed are really nice. I meant that ideally I wouldn't need to install another package for a simple filter operation on the rows. -Júlio 2016-10-12 22:14 GMT-07:00 : > Were you worried about Query being not lightweight enough

Re: [julia-users] Filtering DataFrame with a function

2016-10-12 Thread anthoff
Were you worried about Query being not lightweight enough in terms of overhead, or in terms of syntax? I just added a more lightweight syntax for this scenario to Query. You can now do the following two things: q = @where(df, i->i.price > 30.) that will return a filtered iterator. You can

Re: [julia-users] Filtering DataFrame with a function

2016-10-12 Thread Júlio Hoffimann
Hi David, Thank you for your elaborated answer and for writing a package for general queries, that is great! I will keep the package in mind if I need something more complex. I am currently looking for a lightweight solution within DataFrames, filtering is a very common operation. Right now, I

RE: [julia-users] Filtering DataFrame with a function

2016-10-12 Thread David Anthoff
Hi Julio, you can use the Query package for the first part. To filter a DataFrame using some arbitrary julia expression, use something like this: using DataFrames, Query, NamedTuples q = @from i in df begin @where @select i end You can use any julia code in . Say your