Skip to content

Fix named index columns when filtering dataframe variables - #1548

Open
Lu-Charles wants to merge 2 commits into
Deltares:mainfrom
Lu-Charles:codex/fix-named-dataframe-index
Open

Lu-Charles wants to merge 2 commits into
Deltares:mainfrom
Lu-Charles:codex/fix-named-dataframe-index

Conversation

@Lu-Charles

Copy link
Copy Markdown

Fixes #1502.

When variables is set, the pandas driver can leave a named index_col out of the columns passed to pandas. This causes calls with index_col="time" and parse_dates=["time"] to fail because the time column is missing. Keep the named index column in the selection without duplicating it or modifying the caller's variables list.

Added regression tests for CSV and Excel reads, index-column positions, and combined time and variable filtering through DataCatalog.get_dataframe. The changelog is updated; no catalog definitions are changed.

On Python 3.13, the selected catalog and reader tests passed with 167 passed, 30 skipped, and 77 manual cases excluded. The 46 focused tests also passed with pandas 2.3.3 and 3.0.6. Applicable pre-commit checks passed. The full test suite and CI matrix have not been run.

@Lu-Charles
Lu-Charles marked this pull request as ready for review October 1, 2026 18:12

This branch has not been deployed

No deployments
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.

csv file time parsing fails when using column name instead of index

1 participant