-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug: char.isnumeric returns True for empty strings (NumPy mismatch)
Summary
arkouda.numpy.char.isnumeric does not match NumPy/Python semantics for empty strings.
Specifically, Arkouda returns True for "", while NumPy (np.char.isnumeric) and Python (str.isnumeric) return False.
This was discovered via a new NumPy-alignment verification test.
Expected Behavior (NumPy / Python)
"".isnumeric() # False
np.char.isnumeric([""]) # array([False])Actual Behavior (Arkouda)
ak.char.isnumeric(ak.array([""]))
# pdarray([True])This causes a mismatch in NumPy-alignment tests.
Failing Test
tests/numpy/alignment_verification/char_alignment.py::
TestArkoudaNumpyCharAlignment::test_isnumeric_matches_numpy_char
Mismatch at index 0:
value=''
got=True
expected=False
Root Cause (Likely)
The current implementation treats strings as numeric if all characters are numeric.
For empty strings, this condition is vacuously true, resulting in an incorrect True.
Proposed Fix
Update Strings.isnumeric() (or arkouda.numpy.char.isnumeric) to explicitly treat empty strings as non-numeric, matching NumPy semantics.
Conceptually:
isnumeric(s) = (len(s) > 0) AND all_characters_numeric(s)
Possible implementation:
- AND the existing result with
(self != ""), or - AND with
(string_lengths > 0)if lengths are readily available.
Why This Matters
- Aligns Arkouda string semantics with NumPy and Python
- Prevents subtle downstream bugs in pandas/NumPy compatibility layers
- Strengthens the new NumPy-alignment test suite
Environment
- Arkouda client: 2025.12.16+
- Arkouda server: 2025.12.16+ (minor version mismatch warning present but not believed to be causal)
- Tests executed against a live Arkouda server
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working