The dt arguments that are declared and refused, and the zone database behind half of them
- Dominant language
- Mojo
- Stars
- 1
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
#345 declares every argument pandas declares on the `.dt` accessor and refuses seven of them by name, with the reason in the message and a test per refusal so that none can be dropped later by somebody tidying up. This issue is the list, so that the refusals are a work item rather than a permanent state.
## The list
- `ambiguous` on `dt.floor`, `dt.ceil`, `dt.round` and `dt.tz_localize`. What to do with a wall clock reading that happens twice, on the evening a zone puts its clocks back.
- `nonexistent` on the same four. What to do with a wall clock reading that never happens, on the morning a zone puts its clocks forward.
- `round_ok` on `dt.as_unit`, which is whether converting to a coarser unit may lose precision or must raise.
- A `locale` other than the default on `dt.day_name` and `dt.month_name`. The kernel answers English and refuses anything else, which is the honest behaviour, since answering English to a request for French would be a wrong answer rather than a missing feature.
- `dt.tz_convert(None)`, which moves the column to UTC and then takes the clock off. It is two operations and only the second one exists today.
- A frequency passed as an offset object rather than as a string, on the three roundings. The offset frequencies are M7.
- A zone passed as a `tzinfo` rather than as a name.
## The shape of the work
Four of the seven are one thing. `ambiguous` and `nonexistent` are both questions about a daylight saving transition, and they are unanswerable without a real IANA zone database, which is the same thing that a zone other than a fixed offset or UTC is waiting on. [`19-the-zone-that-needs-no-database.md`](https://github.com/tamnd/firepanda-compat/blob/main/docs/specs/19-the-zone-that-needs-no-database.md) is the document that split the zone work into the half that needed no database and the half that needs nothing else, and this is squarely the second half. The plan on the record is a TZif reader over `/usr/share/zoneinfo`, which is present on every platform this library targets and is a well specified binary format rather than a dependency.
`dt.tz_convert(None)` is small and independent and can be done at any time, since both halves exist and only their composition is missing.
`round_ok` is small. A locale is not, and it is not obviously worth doing at all before somebody asks for one.
An offset object frequency and a `tzinfo` zone are both the same question in different clothes, which is whether the Python layer should accept pandas objects it does not otherwise depend on. That question should be answered once rather than twice.
## Why this is written down
A declared parameter that is accepted and ignored is correct at its default, which is where every quick check uses it, and wrong everywhere else, which is where a real program uses it. That argument has been made three slices running and it holds here. The signature still declares every one of these, because that is what the board's L1 case compares and what a caller reading the help should see, and the refusal is what stops the declaration from becoming a lie.
Contributor guide
Research direction
Start with docs/specs/19-the-zone-that-needs-no-database.md, then inspect the dt accessor declarations and refusal tests introduced by #345. Separate the independent tz_convert(None) and round_ok work from the TZif, locale, offset-object, and tzinfo decisions; done means each supported argument has behavior and tests, while unresolved refusals remain explicit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- data-engineering
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100