Skip to content

Commit

Permalink
Correct category dtype check in ExperimentAxisQuery (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenv authored Aug 10, 2024
1 parent 5e3f5b4 commit 569c196
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python-spec/src/somacore/query/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ def to_anndata(
# Drop unused categories on axis dataframes if requested
if drop_levels:
for name in ad.obs:
if isinstance(ad.obs[name], pd.CategoricalDtype):
if ad.obs[name].dtype.name == "category":
ad.obs[name] = ad.obs[name].cat.remove_unused_categories()
for name in ad.var:
if isinstance(ad.var[name], pd.CategoricalDtype):
if ad.var[name].dtype.name == "category":
ad.var[name] = ad.var[name].cat.remove_unused_categories()

return ad
Expand Down

0 comments on commit 569c196

Please sign in to comment.