Skip to content
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

groupby doesn't transform Vector of Tuples into separate Columns #110

Closed
piever opened this issue Jan 4, 2018 · 1 comment
Closed

groupby doesn't transform Vector of Tuples into separate Columns #110

piever opened this issue Jan 4, 2018 · 1 comment

Comments

@piever
Copy link
Collaborator

piever commented Jan 4, 2018

When groupby takes as input a function that returns NamedTuples, it does not expand the output to separate columns in some cases:

julia> using IndexedTables

julia> df = table(rand(Bool, 100), rand(100), rand(100), names = [:x, :y, :z], pkey = :x);

julia> groupby(t -> map(mean, columns(table(t))), df, select = (:y, :z))
Table with 2 rows, 2 columns:
x      #7
───────────────────────────────────
false  (y = 0.477451, z = 0.48867)
true   (y = 0.575163, z = 0.484047)

When instead one would expect:

julia> using IndexedTables

julia> df = table(rand(Bool, 100), rand(100), rand(100), names = [:x, :y, :z], pkey = :x);

julia> groupby(t -> map(mean, columns(table(t))), df, select = (:y, :z))
Table with 2 rows, 2 columns:
x      y          z
───────────────────────────────────
false  0.477451   0.48867
true   0.575163   0.484047
@piever
Copy link
Collaborator Author

piever commented Apr 10, 2018

Fixed by #150

@piever piever closed this as completed Apr 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant