You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Categorical color obs column crashes the plotting #355
When the "color" is categorical, it crashes and returns ValueError in version 0.2.6. The categorial "test" column contains NaN values. There are 11 possible categories.
[359](https://file+.vscode-resource.vscode-cdn.net/Users/sium/projects/visiumhd/testing/notebooks/~/miniconda/envs/testing/lib/python3.11/site-packages/spatialdata_plot/pl/utils.py:359) "Could not convert values in the `color` column to float, if `color` column represents"
[360](https://file+.vscode-resource.vscode-cdn.net/Users/sium/projects/visiumhd/testing/notebooks/~/miniconda/envs/testing/lib/python3.11/site-packages/spatialdata_plot/pl/utils.py:360) " categories, set the column to categorical dtype."
[361](https://file+.vscode-resource.vscode-cdn.net/Users/sium/projects/visiumhd/testing/notebooks/~/miniconda/envs/testing/lib/python3.11/site-packages/spatialdata_plot/pl/utils.py:361) ) from e
TypeError: '<' not supported between instances of 'str' and 'float'
I tried to reproduce with Visium HD data and I report the following:
plotting categoricals when no values are np.nan works
plotting categoricals when there are np.nan values gives an error. I have tried both when the column is in a table.obs and when the column is directly in the GeoDataFrame.
When the nan value is in table.obs I get your error
When the nan value is in a column of the GeoDataFrame, the plot fails with a different error.
I have tried also putting a nan value in a continuous column. I report the following:
When the nan value is in table.obs, no exception is raised but the plot looks all gray (while it should not). So it still fails.
When the nan value is in a column of the GeoDataFrame, the plot fails (with the same error for the categorical case for dataframe columns).
Actionable for @sinanugur. I suggest to remove the rows with nan values for the moment.
Actionable for us. I suggest to support the handing of nan values and add the following tests:
tests for labels, points, shapes:
add nan values in table.obs columns (both categorical and continous).
add nan values in table.X
tests for points, shapes:
add nan values in the dataframe column (both categorical and continous)
Activity
LucaMarconato commentedon Oct 3, 2024
I tried to reproduce with Visium HD data and I report the following:
np.nanworksnp.nanvalues gives an error. I have tried both when the column is in atable.obsand when the column is directly in theGeoDataFrame.nanvalue is intable.obsI get your errornanvalue is in a column of theGeoDataFrame, the plot fails with a different error.nanvalue in a continuous column. I report the following:nanvalue is intable.obs, no exception is raised but the plot looks all gray (while it should not). So it still fails.nanvalue is in a column of theGeoDataFrame, the plot fails (with the same error for the categorical case for dataframe columns).Actionable for @sinanugur. I suggest to remove the rows with
nanvalues for the moment.Actionable for us. I suggest to support the handing of
nanvalues and add the following tests:nanvalues intable.obscolumns (both categorical and continous).nanvalues intable.Xnanvalues in the dataframe column (both categorical and continous)timtreis commentedon Oct 3, 2024
Thank you so much for the triage @LucaMarconato! ❤️
Handle NaN values in continuous and categorical coloring (#355)