[Feature Request] Add support for clipping values during type enforcement
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 45/100
Research direction
The issue does not name files or tests; start by locating the schema enforcement and casting entry point, then inspect how numeric dtype bounds are handled. The feature is done when an option such as out_of_bounds="clip" bounds values to the target type's minimum and maximum without changing existing behavior by default.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
Currently, when enforcing a schema where data exceeds the range of the target dtype (e.g., a value of 260 for a uint8 column), the operation may fail or lead to silent overflows. In production environments, it is often preferable to bound these values rather than allowing the pipeline to crash or produce corrupted data.
Describe the solution you'd like
I would like to see an option—perhaps a parameter like out_of_bounds="clip"—within the schema enforcement logic. When enabled, any value exceeding the maximum or minimum of the target numeric type would be clipped to that type's limit.
Example Scenario
Target Dtype: uint8 (Range: 0 to 255)
Input Value: 260
Expected Result (with clipping): 255
Describe alternatives you've considered
The current alternative is to manually call .clip() on the DataFrame before validation, but this duplicates logic that could be handled more efficiently during the schema enforcement/casting phase.
- Dominant language
- Python
- Stars
- 618
- Forks
- 21
- Avg merge
- 15h 53m
- Merged PRs (30d)
- 8
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
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.
More from Quantco/dataframely
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Quantco/dataframely#402 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
Quantco/dataframely#357 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Quantco/dataframely#309 · 4 comments · 2 reactions ·
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
Quantco/dataframely#295 · 3 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Quantco/dataframely#272 · 10 comments · 1 reaction ·
All issues in Quantco/dataframely
Similar issues
-
pydanty:is-working
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pydantic/pydantic-ai#8843 ·
Maintainers usually reply within 1 day
-
breaking change enhancement server
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sktime/sktime#11310 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day