Skip to content

Fix bug in drop columns in normalize_coops_stations#178

Open
JackReevesEyre-NOAA wants to merge 1 commit into
masterfrom
fix-coops-normalize
Open

Fix bug in drop columns in normalize_coops_stations#178
JackReevesEyre-NOAA wants to merge 1 commit into
masterfrom
fix-coops-normalize

Conversation

@JackReevesEyre-NOAA

@JackReevesEyre-NOAA JackReevesEyre-NOAA commented Jun 18, 2025

Copy link
Copy Markdown

This PR fixes an issue with how columns are dropped in normalize_coops_stations.

As it was, df.drop was called with columns that might not exist, which would raise an exception. There was already logic in place to check if these columns existed, so I moved the df.drop to be within those if statements.

I ran the test suite (make test) and all the COOPS tests passed (overall, 166 passed, 30 warnings).

@pmav99

pmav99 commented Jun 20, 2025

Copy link
Copy Markdown
Member

Just for the record, another way to tackle this is to use:

df = df.drop([col1, col2, col3], errors="ignore")

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop.html

@JackReevesEyre-NOAA

Copy link
Copy Markdown
Author

The test that fails is only a single version and is related to NDBC tests, not CO-OPS (which is what I changed). So I'm not sure what to do with this... Any ideas @SorooshMani-NOAA @pmav99 ?

@pmav99

pmav99 commented Jul 2, 2025

Copy link
Copy Markdown
Member

the tests we have some providers are flaky. The first thing you should do is to restart/retry the failing tests, although it doesn't always help. If the failing test is not related to the changes in the code then we may merge even with failures.

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.

2 participants