Skip to content

Strings.istitle semantics do not match Python / NumPy #5289

Open

Description

@ajpotts

Summary

ak.Strings.istitle() returns results that differ from Python and NumPy
string semantics. In particular, Arkouda reports True for strings that
are not considered titlecase by Python, such as digit-only strings and
whitespace-only strings.

Reproduction

import arkouda as ak
import numpy as np

data = np.array(["", "a", "AbC", "123", "hello world", "Σ", "ß", "3.14", "  "], dtype=object)

ak.array(data).istitle().to_ndarray()
# Arkouda result (current):
# [False False False True False True False True True]

np.vectorize(lambda x: x.istitle())(data.astype(str))
# NumPy / Python result:
# [False False False False False True False False False]

Expected Behavior

Strings.istitle() should match Python's str.istitle() semantics:

  • At least one cased character
  • First character of each word is uppercase
  • Remaining cased characters are lowercase
  • Digit-only and whitespace-only strings return False

Actual Behavior

Arkouda:

  • Returns True for digit-only strings (e.g., "123", "3.14")
  • Returns True for whitespace-only strings
  • Appears to treat non-letter tokens as titlecase

Impact

  • NumPy alignment tests fail
  • Pandas-style string behavior diverges from expectations
  • Users relying on Python string semantics may get incorrect results

Workaround

The NumPy alignment test suite marks istitle as:

@pytest.mark.xfail(strict=True)

This preserves strict tracking while allowing CI to pass.

Proposed Resolution

  • Update the server-side implementation of Strings.istitle to follow
    Python Unicode titlecase rules, or
  • Explicitly document the current semantics if divergence is intentional

Related Tests

  • tests/numpy/alignment_verification/strings_alignment.py

Activity

  1. added
    bug
    on Jan 9, 2026
  2. added a commit that references this issue on Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions