-
Notifications
You must be signed in to change notification settings - Fork 88
docs: DOC-899: Keyed transpose user guide #7266
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start, just needs some polishing.
title: Keyed transpose | ||
--- | ||
|
||
This guide shows you how to use `keyedTranspose` to transform data from a long format to a wide format by pivoting column values into new column names. This is useful when you need to reshape data for analysis, reporting, or visualization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to keyedTranspose reference doc.
|
||
This guide shows you how to use `keyedTranspose` to transform data from a long format to a wide format by pivoting column values into new column names. This is useful when you need to reshape data for analysis, reporting, or visualization. | ||
|
||
## When to use keyedTranspose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should refer to it as a keyed transpose
in headings and whatnot.
|
||
## When to use keyedTranspose | ||
|
||
Use `keyedTranspose` when you need to: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref link
- Each unique `Level` value (INFO, WARN, ERROR) becomes a column. | ||
- The `Count` aggregation counts occurrences for each Date-Level combination. | ||
|
||
## Working with multiple row keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Working with multiple row keys | |
## Multiple row keys |
|
||
Each unique combination of `Date` and `Server` creates a separate row in the output. | ||
|
||
## Using multiple aggregations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Using multiple aggregations | |
## Multiple aggregations |
| Single aggregation, single column-by | Value from column-by column | `INFO`, `WARN` | | ||
| Multiple aggregations | Aggregation name + value | `Count_INFO`, `Sum_WARN` | | ||
| Multiple column-by columns | Values joined with underscore | `INFO_10`, `WARN_20` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without examples to illustrate these, I don't know what this means.
| Starts with number | Prefixed with `column_` | `123` → `column_123` | | ||
| Duplicate names | Suffix added | `INFO`, `INFO2` | | ||
|
||
### Best practice: Sanitize data before transposing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I'd say this is a best practice. In cases of larger tables, mass string replace operations could be expensive.
A better way to go about this would be to show an example of everything in the table above. Each example can go into its own subsection. Either that, or you can present every item in the table above as a subsection with an example.
|
||
## Common patterns | ||
|
||
### Pattern 1: Sales by region and product |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels more like a simple example than a common pattern.
) | ||
``` | ||
|
||
### Pattern 2: Time-series metrics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO presenting these as examples rather than "common patterns" would be beneficial. I don't see how these are common patterns, but they're obviously useful examples for learning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments on Python that I made on Groovy (if they apply).
http://deephaven.atlassian.net/jira/software/projects/DOC/boards/8?selectedIssue=DOC-899