Repository navigation
fix: support string, date, and datetime bounds in polars fill_gaps - #302
Jakub Krasuski (Blizzeq) wants to merge 3 commits into
Conversation
José Morales (jmoralez)
left a comment
There was a problem hiding this comment.
Hey Jakub Krasuski (@Blizzeq), thanks for your interest in this issue. We try to mimic what each backend supports so pandas allows using strings as dates/datetimes but polars always uses date and datetime objects. we used to have this distinction in the docs but they were migrated to the tests.
What I'd prefer here would be to add a check in the polars branch to see if the bound and the time column don't match and raise a clear error there, e.g. bound is datetime but time column is date.
|
Makes sense, thanks. I dropped the conversion and added a check in the polars branch instead: |
|
Hey Jakub Krasuski (@Blizzeq), I'm very sorry but on a second thought I prefer your first approach. Can you please revert the latest commit so we can pick up from there? |
This reverts commit 55a785c.
|
No problem, reverted in 19dda74 so the branch is back to the conversion approach from the first commit. |
When calling
fill_gapson a Polars DataFrame with a customstartorendtimestamp (such as a string like'2020-01-01', adate, or adatetime),_determine_bound_plcreated aSeries([val])without matching the target dtype of the time column. This caused a panic indatetime_rangeswhen passed string series, or a schema error when joining differing datetime and date keys.This PR ensures
_determine_bound_plconverts scalar bounds (strings, dates, datetimes) to match the time column's target dtype in Polars before building the grid. Added regression tests covering string, date, and datetime bounds on Polars.