arkouda.accessor

Accessor utilities for Arkouda Series-like objects.

This module defines infrastructure for namespace-based accessors (e.g., .str, .dt) on Arkouda Series, mimicking the behavior of pandas-style accessors. It supports extension methods for string and datetime-like values, enabling operations to be performed in a clean, grouped syntax.

Exports

__all__ = [

“CachedAccessor”, “DatetimeAccessor”, “Properties”, “StringAccessor”, “date_operators”, “string_operators”,

]

Components

CachedAccessorclass

Descriptor that lazily initializes and caches accessor objects, such as .str or .dt.

DatetimeAccessorclass

Implements datetime-like operations (e.g., floor, ceil, round) via the .dt accessor.

StringAccessorclass

Implements string-like operations (e.g., contains, startswith, endswith) via the .str accessor.

Propertiesbase class

Base class that provides _make_op for dynamically attaching operations to accessors.

date_operatorsfunction

Class decorator that adds datetime operations to DatetimeAccessor.

string_operatorsfunction

Class decorator that adds string operations to StringAccessor.

Usage

>>> import arkouda as ak
>>> from arkouda import Series
>>> s = Series(["apple", "banana", "apricot"])
>>> s.str.startswith("a")
0     True
1    False
2     True
dtype: bool
>>> from arkouda import Datetime
>>> t = Series(Datetime(ak.array([1_000_000_000_000])))
>>> t.dt.floor("D")
0   1970-01-01
dtype: datetime64[ns]

Notes

These accessors are automatically attached to compatible Series objects. Users should not instantiate accessors directly — use .str and .dt instead.

Classes

Functions

Module Contents

class arkouda.accessor.CachedAccessor(name: str, accessor)[source]

Custom property-like object.

A descriptor for caching accessors.

Parameters:
  • name (str) – Namespace that will be accessed under, e.g. df.foo.

  • accessor (cls) – Class with the extension methods.

Notes

For accessor, The class’s __init__ method assumes that one of Series, DataFrame or Index as the single argument data.

class arkouda.accessor.DatetimeAccessor(series)[source]

Bases: Properties

series
class arkouda.accessor.Properties[source]
class arkouda.accessor.StringAccessor(series)[source]

Bases: Properties

series
arkouda.accessor.date_operators(cls)[source]
arkouda.accessor.string_operators(cls)[source]