lincc-frameworks / lincc-frameworks/nested-pandas
Add padding utility to nested columns
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 26
- Forks
- 8
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 9
Description
**Feature request**
In accordance with increasing ease of use for ML use cases, I suggest we add a method that performs padding on nested structures to produce equal length nested sub-structures per row. My thoughts on API would be:
```
from nested_pandas.utils import pad_nested
import numpy as np
my_nested_padded = pad_nested(my_nested, pad_column="lightcurve", pad_length=100, pad_value=np.nan, output_name="lightcurve") # overwrite name
```
There is some additional quality of life we could add:
* The ability to infer pad_length, which would calculate the longest length and pad to that value. This would be nice, but also introduces a rake for dask-style operations, as it will only be a local longest length and not the global longest length, so I'm tempted to avoid this for now
* It could be a method right on the nestedseries (e.g. `my_nested_padded["lightcurve"].pad(...)`)
**Before submitting**
Please check the following:
- [x] I have described the purpose of the suggested change, specifying what I need the enhancement to accomplish, i.e. what problem it solves.
- [x] I have included any relevant links, screenshots, environment information, and data relevant to implementing the requested feature, as well as pseudocode for how I want to access the new functionality.
- [] If I have ideas for how the new feature could be implemented, I have provided explanations and/or pseudocode and/or task lists for the steps.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating nested_pandas.utils and the NestedSeries implementation referenced by the proposed API. Review how nested structures and columns are represented, then define the supported padding arguments and output behavior. Done means the utility handles the stated fixed-length padding example and has tests covering padding values, lengths, and overwrite naming.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, pandas, python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100