Skip to content

Pandas ExtensionArray: allow dtype="ak" for generic Arkouda-backed arrays #5303

Closed

Description

@ajpotts

Description

Currently, constructing a pandas array backed by Arkouda requires specifying a concrete Arkouda dtype, e.g.

pd.array(data, dtype="ak_int64")
pd.Series(data, dtype="ak_float64")

This is unnecessarily verbose and diverges from pandas conventions, where users typically specify a backend or family, not an exact storage dtype, and allow the system to infer the concrete type.

This ticket proposes supporting a generic Arkouda dtype, e.g.

pd.array(data, dtype="ak")
pd.Series(data, dtype="ak")

which would infer the appropriate Arkouda dtype from the input data and construct the corresponding Arkouda-backed ExtensionArray.

Motivation

  • Improves ergonomics and discoverability of Arkouda’s pandas integration
  • Aligns with pandas patterns (dtype="string", "boolean", "category")
  • Lowers the barrier to entry for users unfamiliar with Arkouda’s full dtype taxonomy
  • Enables a cleaner transition path from NumPy/pandas objects to Arkouda-backed arrays

In practice, users often want “an Arkouda array” rather than “an Arkouda int64 array,” especially when prototyping or writing backend-agnostic code.

Proposed Behavior

When dtype="ak" is provided:

  1. Pandas routes construction to the Arkouda ExtensionArray
  2. The Arkouda dtype is inferred from:
    • the input data (e.g., list, NumPy array, pandas array), or
    • an existing Arkouda object, if provided
  3. The inferred concrete dtype (e.g. ak_int64, ak_float64, ak_string, ak_categorical) is used internally

Example:

pd.array([1, 2, 3], dtype="ak")        # -> ak_int64
pd.array([1.0, 2.0], dtype="ak")       # -> ak_float64
pd.array(["a", "b"], dtype="ak")       # -> ak_string

Explicit Arkouda dtypes (dtype="ak_int64", etc.) continue to work unchanged.

Scope / Implementation Notes

  • Add a generic ArkoudaDtype (or alias) that dispatches to concrete dtypes
  • Hook into pandas’ dtype resolution / construction path for pd.array and Series
  • Ensure round-trip behavior with:
    • Series.dtype
    • astype("ak")
    • Series.array
  • Error clearly when inference is ambiguous or unsupported

Non-Goals

  • Changing or removing existing concrete Arkouda dtypes
  • Adding implicit conversions from arbitrary object arrays without validation
  • Replacing pandas’ own dtype inference rules

Acceptance Criteria

  • pd.array(..., dtype="ak") constructs a valid Arkouda ExtensionArray
  • Concrete dtype is inferred correctly and consistently
  • Existing Arkouda dtype strings remain supported
  • Behavior is covered by unit tests

Activity

  1. self-assigned this
    on Jan 12, 2026
  2. added 7 commits that reference this issue on Jan 12, 2026
    8c28e4b
    bbf42b4
    b7eed45
    cfc9e7e
    11fcad3
    305014d
    e943df5
  3. added a commit that references this issue on Feb 10, 2026
    ee9085a
  4. added a commit that references this issue on Feb 10, 2026
    4227af2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions