-
Notifications
You must be signed in to change notification settings - Fork 15
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
Customize the Dict type for group
#18
Comments
Thank you :) Yes, this is an important problem. I've thought of only two things so far:
Note that we have the same general problem with functions like |
It's not clear to me why the output of For instance, here's a data pipeline I just wrote (related to what I was trying to do in #22). In the 2nd line, the first thing I do after the group operation is to convert it into a rt60s = group(r->r.freq, r->r.rt60, ir_analysis) |>
d -> map(tuple, collect(keys(d)), d) |>
d -> sort(d; by=first) |>
d -> map(d) do r
n = count(!ismissing, r[2])
m = n == 0 ? missing : mean(skipmissing(r[2]))
(freq=r[1], count=n, mean=m)
end
@df rt60s plot(:freq, :mean) Maybe it's just my unfamiliarity with Dictionaries,jl preventing me from seeing the right way to do this - for me it's easier to work with familiar data types. |
Sorry for not responding to this earlier.
As an an intermediate step to create the groups, you need to create a dictionary to efficiently push the elements into the correct group. (The alternative way is to first sort the elements by the grouping function and then use As to your example, there are several enhancements I want that should make your life easier.
For now, ignoring sorting by groups = groupview(r.freq, r.rt60);
freq = keys(groups)
count = (length ∘ skipmissing).(groups);
mean = (mean ∘ skipmissing).(groups);
plot(collect(freq), collect(mean)) However later I hope we can get these pre-sorted and in a table-like structure. :) |
Apparenlty that doesn't work (yet). I got carried away: JuliaLang/julia#35946, JuliaLang/julia#35947 |
Hello, I'm using this great package to do basic data operations, and just found myself wanting to get back an
OrderedDict
from DataStructures.jl, since the order in which values appear in the iterable is significant.I see there's some type promotion optimization going on in the
group
code, and I wonder if it would be possible to support passing in or otherwise specifying the output type in a way that preserves good type information.Thanks for your work on this package!
The text was updated successfully, but these errors were encountered: