fix: add support for boolean data in apply_categorical_cmap#1134
fix: add support for boolean data in apply_categorical_cmap#1134saschabuehrle wants to merge 1 commit into
Conversation
Boolean arrays are not supported by the arro3 dictionary_encode function,
causing a 'Boolean not supported in rank' error when using boolean values
with apply_categorical_cmap.
This fix:
1. Detects boolean arrays before dictionary encoding
2. Converts boolean values to strings ('True'/'False') for encoding
3. Maps string keys back to boolean keys during colormap lookup
4. Preserves the original boolean-based colormap interface
Includes test case to verify boolean values work correctly.
Fixes #1122
|
Thanks for the PR, but the fix should really go in arro3-core. I don't want to complicate the logic here, just to work around I'd suggest writing some tests in |
|
Thanks for the clarification. Agreed that the underlying fix belongs in arro3-core. I’ll stop iterating on this workaround PR on lonboard and follow the upstream path instead.\n\nGreetings, saschabuehrle |
|
Thanks for the clear guidance � agreed this belongs in arro3-core rather than adding workaround logic here.\n\nI�ll stop pushing this approach in lonboard and can move the fix proposal + tests to arro3-core so this can stay clean.\n\nGreetings, saschabuehrle |
|
Thanks for the guidance. Agreed this belongs in arro3-core rather than adding workaround logic here. I’ll move the fix upstream there and keep this PR out of the way.\n\nGreetings, saschabuehrle |
|
Same as pSpitzner/beets-flask#291 (comment)
|
Problem
Using
apply_categorical_cmapwith boolean data throws an error:This happens because the underlying
arro3.compute.dictionary_encodefunction doesn't support boolean arrays.Solution
Added support for boolean arrays by:
Example Usage
Testing
Added test case
test_discrete_cmap_boolean()to verify boolean values work correctly and produce the expected color mapping.The fix is backward compatible and doesn't affect existing functionality with string, numeric, or other supported data types.
Fixes #1122
Greetings, saschabuehrle