A4. `DatetimeIndex`, 144 members, L3 90 percent
- Dominant language
- Mojo
- Stars
- 1
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
`pandas.DatetimeIndex` has 144 public members. Before this workstream started firepanda had none of them, because the name did not exist, so every resolution case and every signature case the conformance board carries for it failed at L0, which is the level that asks only whether the name resolves. That is the largest single block of unscored cases on the board.
It is also the cheapest, because most of the type is already written somewhere else. An index of instants is an ordinary index whose labels are a timestamp column, and a timestamp column is int64 underneath, so every set operation, every lookup, every slice bound and every sort on it is behaviour `Index` already had and is correct without being told about the calendar. The calendar itself is the `dt` accessor, which has the nineteen fields, the frequency parser and the rounding rules already. The work is assembly rather than new kernels, and `docs/specs/33-an-index-of-instants.md` argues that at length.
### The 68 names that are not there yet
Fifty three of them are not about the calendar at all. They are `Index` members this type inherits the day the flat index has them, which is #154, so finishing that workstream finishes most of this one for nothing. The two are sequenced together for that reason.
Of the fifteen that are about the calendar, `isocalendar` needs an index to hand back a frame and the binding for it would make `index.mojo` import `PySeries`, which is a cycle. `freq`, `freqstr`, `inferred_freq` and `resolution` need frequency inference. `time` and `timetz` need a time of day column type. `to_period` needs a period type. `to_pydatetime` needs a column of Python objects and `to_julian_date` needs a calendar conversion. `mean` and `std` need the reductions to know that the average of two timestamps is a timestamp. `snap`, `indexer_at_time` and `indexer_between_time` are ordinary work with nothing blocking them.
Nothing on that list is spelled as a name that refuses, because document 07 says a name must not resolve and then refuse.
### Done when
- [x] The type exists, subclasses `Index`, and is built by the one parser the rest of the library uses
- [x] The nineteen calendar fields, the three roundings, `normalize`, `as_unit`, `day_name`, `month_name`, `strftime`, `date` and the two clock moves, all of them reaching the same kernels the `dt` accessor reaches
- [x] A member that answers something about an instant answers an `Index` and a member that answers an instant answers a `DatetimeIndex`, which is what pandas does
- [x] Every difference from pandas that is not a bug is written down, which is section 5 of document 33
- [ ] The generated `Index` members answer the subclass rather than a plain `Index`, so a chain keeps its calendar
- [ ] `isocalendar`, `snap`, `indexer_at_time` and `indexer_between_time`
- [ ] L3 at 90 percent or better for the workstream, with the remaining 10 percent named rather than unexplained
### How this is measured
The levels are the ones `docs/specs/01-what-100-percent-means.md` defines and `docs/specs/02-the-surface.md` enumerates, scored by the conformance board in tamnd/firepanda-compat and reported against the checklist in `docs/specs/08-m6.md`. A name that answers something other than pandas answers counts only if the difference is in the divergence registry with a reason, since an unregistered difference is a failure and a registered one is a decision.
Part of #8, milestone M6.
Contributor guide
Research direction
Start with docs/specs/33-an-index-of-instants.md and the existing DatetimeIndex implementation in index.mojo, then compare the missing members with issue #154. Run the conformance board in tamnd/firepanda-compat against docs/specs/02-the-surface.md and docs/specs/08-m6.md. Done means generated members preserve the subclass, the listed calendar methods work, and the workstream reaches 90% with remaining differences documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas
- Domain
- data-engineering
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100