Add PrettyTables rendering for GDTable#48
Open
harsharora21 wants to merge 11 commits intoJuliaParallel:mainfrom
Open
Add PrettyTables rendering for GDTable#48harsharora21 wants to merge 11 commits intoJuliaParallel:mainfrom
harsharora21 wants to merge 11 commits intoJuliaParallel:mainfrom
Conversation
Co-authored-by: Julian Samaroo <jpsamaroo@gmail.com>
Member
Codecov ReportPatch coverage has no change and project coverage change:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #48 +/- ##
==========================================
- Coverage 95.47% 92.46% -3.01%
==========================================
Files 12 12
Lines 861 889 +28
==========================================
Hits 822 822
- Misses 39 67 +28
☔ View full report in Codecov by Sentry. |
Contributor
Author
|
Newer commit makes it more like dataframe. ExampleCreate a sample table julia> dt = DTable((a=[0,1,2,0,1,2,0,0,1,1], b=[0,1,2,3,4,5,6,7,8,9]), 10);Groupby without functionjulia> gdt = groupby(dt, :a);
julia> gdt #limited printing
GDTable with 3 partitions and 3 keys
Tabletype: NamedTuple
Grouped by: [:a]
First Group (4 rows): a = 0
┌───┬───┐
│ a │ b │
├───┼───┤
│ 0 │ 0 │
│ 0 │ 3 │
│ 0 │ 6 │
│ 0 │ 7 │
└───┴───┘
⋮
Last Group (2 rows): a = 2
┌───┬───┐
│ a │ b │
├───┼───┤
│ 2 │ 2 │
│ 2 │ 5 │
└───┴───┘
julia> print(gdt)
GDTable with 3 partitions and 3 keys
Tabletype: NamedTuple
Grouped by: [:a]
Group 1 (4 rows): a = 0
┌───┬───┐
│ a │ b │
├───┼───┤
│ 0 │ 0 │
│ 0 │ 3 │
│ 0 │ 6 │
│ 0 │ 7 │
└───┴───┘
Group 2 (4 rows): a = 1
┌───┬───┐
│ a │ b │
├───┼───┤
│ 1 │ 1 │
│ 1 │ 4 │
│ 1 │ 8 │
│ 1 │ 9 │
└───┴───┘
Group 3 (2 rows): a = 2
┌───┬───┐
│ a │ b │
├───┼───┤
│ 2 │ 2 │
│ 2 │ 5 │
└───┴───┘
Groupby with functionjulia> function rowsum(row)
return row.a + row.b
end
rowsum (generic function with 1 method)
julia> gdt = groupby(dt, rowsum);
julia> gdt #limited printing
GDTable with 9 partitions and 9 keys
Tabletype: NamedTuple
Grouped by: rowsum
First Group (1 rows): Function rowsum = 0
┌───┬───┐
│ a │ b │
├───┼───┤
│ 0 │ 0 │
└───┴───┘
⋮
Last Group (1 rows): Function rowsum = 10
┌───┬───┐
│ a │ b │
├───┼───┤
│ 1 │ 9 │
└───┴───┘
julia> print(gdt)
GDTable with 9 partitions and 9 keys
Tabletype: NamedTuple
Grouped by: rowsum
Group 1 (1 rows): Function rowsum = 0
┌───┬───┐
│ a │ b │
├───┼───┤
│ 0 │ 0 │
└───┴───┘
Group 2 (1 rows): Function rowsum = 2
┌───┬───┐
│ a │ b │
├───┼───┤
│ 1 │ 1 │
└───┴───┘
Group 3 (1 rows): Function rowsum = 3
┌───┬───┐
│ a │ b │
├───┼───┤
│ 0 │ 3 │
└───┴───┘
Group 4 (1 rows): Function rowsum = 4
┌───┬───┐
│ a │ b │
├───┼───┤
│ 2 │ 2 │
└───┴───┘
Group 5 (1 rows): Function rowsum = 5
┌───┬───┐
│ a │ b │
├───┼───┤
│ 1 │ 4 │
└───┴───┘
Group 6 (1 rows): Function rowsum = 6
┌───┬───┐
│ a │ b │
├───┼───┤
│ 0 │ 6 │
└───┴───┘
Group 7 (2 rows): Function rowsum = 7
┌───┬───┐
│ a │ b │
├───┼───┤
│ 2 │ 5 │
│ 0 │ 7 │
└───┴───┘
Group 8 (1 rows): Function rowsum = 9
┌───┬───┐
│ a │ b │
├───┼───┤
│ 1 │ 8 │
└───┴───┘
Group 9 (1 rows): Function rowsum = 10
┌───┬───┐
│ a │ b │
├───┼───┤
│ 1 │ 9 │
└───┴───┘
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

As suggested by @krynju, This PR adds PrettyTables rendering for GDTable
Example