docs: Update resolution docstrings to reference truncate instead of round#283
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #283 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 54 54
Lines 3125 3125
=========================================
Hits 3125 3125 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request corrects a semantic inaccuracy in the docstrings for datetime-related column types. The docstrings previously referenced the polars round method for the resolution parameter's formatting language, but the actual implementation uses the polars truncate method. While both methods share the same formatting strings, their behavior differs materially: round maps values to bucket endpoints, whereas truncate maps to bucket starts. This documentation update ensures accuracy and clarity for users understanding the strict boundary validation behavior.
Changes:
- Updated docstrings in
Date,Time,Datetime, andDurationclasses to referencetruncatemethod instead ofroundmethod
Summary
In
dataframely/columns/datetime.py, the docstrings for theDate,Time,Datetime, andDurationclasses state that the resolution argument uses the formatting language of thepolarsdatetimeroundmethod.This is semantically confusing, as the actual underlying implementation uses the
polarsdatetimetruncatemethod.Motivation
While both methods share the same formatting strings, their behavior is materially different. The
roundmethod maps values in the second half of an interval to the end of their bucket, whereastruncatemaps each value to the start of its bucket. Updating the docstring to reference truncate accurately reflects the strict boundary validation happening under the hood.Changes
Updated docstrings in
Date,Time,Datetime, andDurationto replace "roundmethod" with "truncatemethod".