Skip to content

Commit

Permalink
KeyError fix issue #423 (#428)
Browse files Browse the repository at this point in the history
* keyerror fix

* nox fix
  • Loading branch information
namsaraeva authored Dec 9, 2022
1 parent 8c392be commit 50fd5c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ehrapy/anndata/anndata_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ def _move_columns_to_obs(df: pd.DataFrame, columns_obs_only: list[str] | None) -
obs = df[columns_obs_only].copy()
obs = obs.set_index(df.index.map(str))
df = df.drop(columns_obs_only, axis=1)
except KeyError:
raise ColumnNotFoundError from KeyError(
except KeyError as e:
raise ColumnNotFoundError(
"One or more column names passed to column_obs_only were not found in the input data. "
"Are the column names spelled correctly?"
)
) from e
else:
obs = pd.DataFrame(index=df.index.map(str))
logg.info("Added all columns to `obs`.")
Expand Down

0 comments on commit 50fd5c2

Please sign in to comment.