Skip to content

Keep formatters aligned when deleting columns - #706

Open
pabszero wants to merge 3 commits into
jazzband:masterfrom
pabszero:fix-formatters-after-column-deletion
Open

pabszero wants to merge 3 commits into
jazzband:masterfrom
pabszero:fix-formatters-after-column-deletion

Conversation

@pabszero

Copy link
Copy Markdown

Deleting a column leaves formatter positions unchanged. With headers id, name, city and add_formatter('name', str.upper), deleting id exports the name unchanged and uppercases the city instead. Deleting the formatted column can also apply its callback to the next column or raise an indexing/type error.

Remap surviving formatter positions and remove callbacks for the deleted column. Preserve global callback order and negative indices' existing relative-to-end behavior, including after a later append_col.

Tests cover preceding/deleted columns, named and integer references, global callback order and negative-index compatibility. The original source produces six regression failures. The fixed full test suite passes on Windows CPython 3.12.14 and 3.13.5: 187 tests and 6 subtests each. The 3.13 run also collected coverage. Ruff and git diff --check pass, and an independent review reran the focused tests. Optional pandas, other platforms/interpreters, full tox and package builds were not checked.

AI assistance (OpenAI Codex) was used to investigate, implement, review and test this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant