Fix to_datetime nanosecond inference and DatetimeIndex tz wall-time interpretation - #23141
Conversation
|
/okay to test d4e2eba |
📝 WalkthroughWalkthroughModifies DatetimeIndex construction to interpret timezone-naive strings as wall time when given a tz-aware dtype, updates to_datetime's strptime precision inference based on fractional-second format width, adjusts pandas-testing-plugin xfail expectations accordingly, and adds corresponding tests. ChangesDatetime precision and timezone handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@python/cudf/cudf/tests/general_functions/test_to_datetime.py`:
- Around line 421-430: The test `test_datetime_index_tz_dtype_wall_time` only
covers string input for `cudf.DatetimeIndex` with `pd.DatetimeTZDtype("s",
"US/Eastern")`; add an integer epoch case in the same test so the numeric
construction path is also verified. Use a numeric timestamp input and assert it
matches the corresponding `pd.DatetimeIndex` result, ensuring `assert_eq` covers
both string and int behavior for this wall-time timezone dtype.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ecaf5e04-21ab-4466-a196-e3306cf814a1
📒 Files selected for processing (4)
python/cudf/cudf/core/index.pypython/cudf/cudf/core/tools/datetimes.pypython/cudf/cudf/pandas/scripts/pandas-testing-plugin.pypython/cudf/cudf/tests/general_functions/test_to_datetime.py
💤 Files with no reviewable changes (1)
- python/cudf/cudf/pandas/scripts/pandas-testing-plugin.py
|
/okay to test f3915e7 |
|
/merge |
to_datetimeinfers nanosecond precision for strings with more than 6 fractional-second digits, matching pandas.DatetimeIndexwith a timezone dtype treats timezone-naive strings/datetimes as wall time in the target timezone, while numeric data stays interpreted as UTC epoch values.