tamnd / tamnd/firepanda

J. The 46 pandas error and warning types

Open
#152 0 comments 0 reactions 0 assignees View on GitHub
parity
Dominant language
Mojo
Stars
1
Forks
0
Avg merge
1h 31m
Merged PRs (30d)
640

Description

`pandas.errors` holds 46 exception and warning types and firepanda currently raises whatever Mojo raised. This is first in M6 and it is not negotiable on schedule grounds, because every operation written after these exist raises the right type at the point where it fails, and every operation written before them has to be revisited. Retrofitting error types across 500 callables is a task that never actually happens.

It is also the smallest piece of work in the milestone that improves conformance across the whole library at once. L4 is unreachable for any operation until the type it should raise exists.

### The 46 types

`AbstractMethodError`, `AttributeConflictWarning`, `CSSWarning`, `CategoricalConversionWarning`, `ChainedAssignmentError`, `ClosedFileError`, `DataError`, `DatabaseError`, `DtypeWarning`, `DuplicateLabelError`, `EmptyDataError`, `IncompatibilityWarning`, `IncompatibleFrequency`, `IndexingError`, `IntCastingNaNError`, `InvalidColumnName`, `InvalidComparison`, `InvalidIndexError`, `InvalidVersion`, `LossySetitemError`, `MergeError`, `NoBufferPresent`, `NullFrequencyError`, `NumExprClobberingError`, `NumbaUtilError`, `OptionError`, `OutOfBoundsDatetime`, `OutOfBoundsTimedelta`, `Pandas4Warning`, `Pandas5Warning`, `PandasChangeWarning`, `PandasDeprecationWarning`, `PandasFutureWarning`, `PandasPendingDeprecationWarning`, `ParserError`, `ParserWarning`, `PerformanceWarning`, `PossibleDataLossError`, `PossiblePrecisionLoss`, `PyperclipException`, `PyperclipWindowsException`, `SpecificationError`, `UndefinedVariableError`, `UnsortedIndexError`, `UnsupportedFunctionCall`, `ValueLabelTypeMismatch`.

A handful of those are about pandas internals we will never have, `PyperclipWindowsException` being the clearest example. Those are still defined, because a user's `except` clause naming one has to import, and they are simply never raised. Defining a name costs nothing and a missing name is an `ImportError` in somebody's error handling path.

### Done when

- [ ] Every one of the 46 names exists and has the same inheritance as its pandas original, so `except ValueError` keeps catching what it catches today
- [ ] The types most likely to be caught by real code raise from the real code paths: `MergeError`, `IndexingError`, `InvalidIndexError`, `DuplicateLabelError`, `IntCastingNaNError`, `OutOfBoundsDatetime`, `SpecificationError`, `EmptyDataError`, `ParserError`, `DataError`
- [ ] Messages name the column, dtype or value that caused the failure, since L4 checks a substring of the message and a message that says "invalid input" is useless to the person reading it
- [ ] The parser raises `ParserError` and `EmptyDataError` from the CSV path, which is where a user meets their first pandas exception
- [ ] Warnings are warnings and go through the warning machinery, not through print

### 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 with the pandas.errors surface and the CSV path, then locate the exception and warning definitions and their real code paths in firepanda. Run pixi run conformance in firepanda-compat and read the referenced milestone and surface specifications; done means all 46 names, required inheritance, messages, warning behavior, and deliberate divergences are covered.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.