Repository navigation
fix: support pyarrow-backed dates in offset_times and time_ranges - #303
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t import Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Array offsets can silently truncate subsecond results before Arrow dtype restoration.
2 open findings
What changed in this PR
Adds pyarrow-backed date support to pandas time-offset utilities.
Changes:
- Converts Arrow dates for offset calculations and restores Arrow dtypes.
- Rejects non-midnight results for Arrow date types.
- Adds Arrow timestamp/date integration tests.
| File | Description |
|---|---|
utilsforecast/processing.py |
Implements Arrow date conversion and offset handling. |
tests/test_processing.py |
Tests Arrow-backed temporal operations and integrations. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…date64 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drops keep_resolution and the arrow handling in time_ranges, which now come from offset_times after #308. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…illiseconds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The offset logic looks correct. A few things before merging: PR description. The description says this fixes "the feature engineering functions with
Midnight error blames the offset ( Duplicated tz conversion ( |
…uts with a time part Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d drop unrelated test reformatting Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


What
offset_timesandtime_rangesconvert pyarrow-backed dates (naive and tz-aware timestamps,date32/date64) to numpy-backed ones, reuse the existing offset logic and cast the result back to the original arrow dtype.offset_timesreturns the finer unit, as it does for numpy-backed times.date32/date64values to times that aren't at midnight (e.g. sub-daily frequencies) raises aValueErrorinstead of silently dropping the time.date64inputs that already have a time part raise a separateValueErrorthat points at the input.n, Series and Index inputs, nulls,make_future_dataframeandbacktest_splits.Why
Both functions raised
ArrowTypeError: No temporal attributes found on object.for pyarrow-backed dates (andoffset_timeswith an arraynfailed fordate32), which brokemake_future_dataframe,backtest_splits,future_exog_to_historic, andfourierandtrendwithh > 0for those inputs (time_featuresstill fails on them for an unrelated reason, handled in #298). pyarrow can't do calendar arithmetic itself, so the pandas offsets are applied on numpy-backed dates.Fixes #309
🤖 Generated with Claude Code