#928 quarterly warning#929
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #929 +/- ##
==========================================
+ Coverage 88.28% 88.32% +0.03%
==========================================
Files 88 88
Lines 5029 5037 +8
Branches 642 642
==========================================
+ Hits 4440 4449 +9
+ Misses 444 443 -1
Partials 145 145
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 402a080. Configure here.
|
I had the entirely wrong idea of what this PR would look like. I was honestly thinking you would just change the underlying data.
|
|
I can try that. It would be something like replacing data like Is there anywhere in the docs that has best practice for the date formats? The docs are quite hard to search. If absent, we could add that the best way to format a quarterly triangle would be to have the month beginning of the quarter rather than using a Q, which could be inferred but will cause performance issues. |
|
I think the term I was looking for was ISO 8601, we could update the docs to say the best practice would be to encode the dates as ISO 8601 compatible. |
There is this. We can definitely beef it up. |

Summary of Changes
Handles quarterly edge case when conducting datetime inference. Python doesn't have a native datetime format string for quarterly dates, so I decided to intercept the UserWarning and handle the quarterly case separately.
Reduces the number of warnings from 1112 to 1080.
Related GitHub Issue(s)
#840
#928
Additional Context for Reviewers
uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Medium Risk
Changes core Triangle date parsing used at construction; quarterly fallback could affect edge-case origin/development labels, though behavior for known formats should stay the same.
Overview
TriangleBase._to_datetimenow treatsUserWarningfrompd.to_datetimeas a failed inference attempt (viawarnings.filterwarnings('error')) instead of letting quarterly strings warn and still partially parse. When the usual format list fails, it falls back topd.PeriodIndex(..., freq='Q').to_timestamp, honoringperiod_endthrough a sharedstart_endflag for period timestamps.A regression test asserts
Trianglestill raisesValueErrorwith "Unable to infer datetime" when origin/development strings use incompatible formats (e.g.1995/Q1vs1995Q1).Triangledocs only clarify thedatatype asDataFrame | DataFrameXchg | dict.Reviewed by Cursor Bugbot for commit 99682fe. Bugbot is set up for automated code reviews on this repo. Configure here.