Draft
Fix detect_outliers_ecod to handle pandas Series and missing values#64
Conversation
2 tasks
…add tests Agent-Logs-Url: https://github.com/biosustain/growthcurves/sessions/1368598d-2184-4c36-8227-40e60ec6dc36 Co-authored-by: enryH <2833836+enryH@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix ECOD to accept missing data and pandas Series
Fix detect_outliers_ecod to handle pandas Series and missing values
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
detect_outliers_ecodused raw integer indexing (N[0],N[i], slices) which breaks silently when passed a pandas Series with a non-default index (label-based access). Additionally, NaN inputs caused obscure ECOD fitting errors with no actionable message.Changes
Ntonp.ndarrayvianp.asarray(N, dtype=float)at function entry — fixes label-vs-position indexing for any pandas Series indexValueErrorwith a clear message when input contains NaN values, rather than letting ECOD fail opaquelyTests added
test_ecod_pandas_series_default_index— baseline Series casetest_ecod_pandas_series_non_default_index— previously broken pathtest_ecod_numpy_array— regression guardtest_ecod_missing_values_raises— NaN in ndarray raisesValueErrortest_ecod_missing_values_in_series_raises— NaN in Series raisesValueError