astrodbtoolkit / astrodbtoolkit/AstrodbKit
Add method to pivot results
- Dominant language
- Python
- Stars
- 12
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
In some situations, we may need to group results and shift values into individual columns.
The example that comes to mind is data sorted like this:
```
name parameter value
source1 C/O ratio 0.1
source1 velocity -2
source1 mass 10
source2 C/O ratio 0.2
source2 mass 1
```
While this is fine, the user may want instead a table of the form:
```
name C/O ratio velocity mass
source1 0.1 -2 10
source2 0.2 None 1
```
This can be done with some group by commands, but we may want to provide a method `.pivot` to handle this automatically for the user, with an option to pass along what column name should be the pivot.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the existing result and group-by query APIs in the Python/SQLAlchemy codebase and review how users currently reshape results. Define the pivot method's column-name option and behavior for missing values such as source2's velocity. Done means the example data produces one row per name with parameter values as columns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlalchemy
- Domain
- backend-api-design, data, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100