tamnd / tamnd/firepanda

A3. loc, iloc, at, iat, xs and the methods that need an index

Open
#156 16 comments 0 reactions 0 assignees View on GitHub
area/frame parity
Dominant language
Mojo
Stars
1
Forks
0
PR merge metrics
PR metrics pending

Description

The selection surface, which is the part of pandas every user touches within five minutes and the part with the most behaviour per character of syntax. `df.loc[a, b]` covers scalar, list, slice, boolean array and callable in both positions, and the return type changes with the combination. This is where a conformance suite earns its cost, because the number of shapes is large and each of them is one line of user code.

It is one issue with `Index` rather than folded into it, because the indexers are a dispatch problem and the index is a data structure problem, and they are testable separately.

### Done when

- [ ] `loc` over scalar, list, slice, boolean mask and callable, in both the row and the column position, with the pandas rule that a label slice includes its endpoint
- [ ] `iloc` over the same shapes with positional semantics, where a slice excludes its endpoint, which is the single most common source of confusion in pandas and has to match exactly
- [ ] `at` and `iat`, scalar only, raising the same way on a non scalar as pandas does
- [ ] `xs` including the `level` and `drop_level` parameters
- [ ] Assignment through `loc` and `iloc`, including the enlargement case where assigning to a missing label adds a row
- [ ] `IndexingError` raised where pandas raises it, which is the dependency on the error types issue
- [ ] The frame methods that need an index behave: `reindex`, `align`, `set_index`, `reset_index`, `sort_index`, `drop` by label, `rename`
- [ ] L3 at 100 percent, because there is no acceptable partial version of this

### How this is measured

The target above is an L3 rate over this workstream's callables, reported by `pixi run conformance` in [firepanda-compat](https://github.com/tamnd/firepanda-compat) and enforced by the CI ratchet rather than by a person ticking a box. L3 means every parameter takes every one of its values and the combinations that interact are enumerated. The levels are defined in [01-what-100-percent-means.md](https://github.com/tamnd/firepanda-compat/blob/main/docs/specs/01-what-100-percent-means.md), the counts come from [02-the-surface.md](https://github.com/tamnd/firepanda-compat/blob/main/docs/specs/02-the-surface.md), and the ordering argument for this milestone is in [08-m6.md](https://github.com/tamnd/firepanda-compat/blob/main/docs/specs/08-m6.md).

Anything we deliberately will not do goes in the divergence registry with a reason before this issue closes, and a registered divergence still runs and still has to diverge.

Part of #8, milestone M6.

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked firepanda-compat specs, especially 01-what-100-percent-means.md, 02-the-surface.md, and 08-m6.md, then run `pixi run conformance` to inspect the current workstream. Done means the listed indexers and frame methods reach L3 at 100 percent, with divergences registered and enforced by the CI ratchet.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.