arkouda.numpy.dtypes¶
Classes¶
Built-in immutable sequence. |
|
Built-in immutable sequence. |
|
Built-in immutable sequence. |
|
Built-in immutable sequence. |
|
Built-in immutable sequence. |
|
BoolDType() |
|
Int8DType() |
|
BytesDType(size, /) |
|
CLongDoubleDType() |
|
The central part of the internal API. |
|
Complex128DType() |
|
Complex64DType() |
|
Build an immutable unordered collection of unique elements. |
|
Build an immutable unordered collection of unique elements. |
|
DateTime64DType(unit, /) |
|
Create a collection of name/value pairs. |
|
Float16DType() |
|
Float32DType() |
|
Float64DType() |
|
Int16DType() |
|
Int32DType() |
|
Int64DType() |
|
Int8DType() |
|
Int32DType() |
|
Special typing form to define literal types (a.k.a. value types). |
|
Int64DType() |
|
LongDoubleDType() |
|
LongLongDType() |
|
dict() -> new empty dictionary |
|
Build an immutable unordered collection of unique elements. |
|
ObjectDType() |
|
Optional[X] is equivalent to Union[X, None]. |
|
Build an immutable unordered collection of unique elements. |
|
dict() -> new empty dictionary |
|
Int16DType() |
|
StrDType(size, /) |
|
TimeDelta64DType(unit, /) |
|
Special form for marking type aliases. |
|
Special typing construct for marking user-defined type predicate functions. |
|
UInt8DType() |
|
UInt16DType() |
|
UInt32DType() |
|
UInt64DType() |
|
UInt8DType() |
|
UInt32DType() |
|
UInt64DType() |
|
ULongLongDType() |
|
UInt16DType() |
|
Union type; Union[X, Y] means either X or Y. |
|
VoidDType(length, /) |
|
Mixin to prevent iteration, without being compatible with Iterable. |
|
Dtype sentinel for Arkouda's variable-width (arbitrary-precision) integers. |
|
Scalar type for Arkouda's variable-width integer dtype. |
|
Unsigned signed integer type, 64bit on 64bit systems and 32bit on 32bit systems. |
|
Boolean type (True or False), stored as a byte. |
|
Boolean type (True or False), stored as a byte. |
|
Mixin to prevent iteration, without being compatible with Iterable. |
|
Complex number type composed of two double-precision floating-point numbers, |
|
Complex number type composed of two single-precision floating-point numbers. |
|
Half-precision floating-point number type. |
|
Single-precision floating-point number type, compatible with C |
|
Double-precision floating-point number type, compatible with Python |
|
Mixin to prevent iteration, without being compatible with Iterable. |
|
Signed integer type, compatible with C |
|
Signed integer type, compatible with C |
|
Signed integer type, compatible with C |
|
Signed integer type, compatible with C |
|
Build an immutable unordered collection of unique elements. |
|
Mixin to prevent iteration, without being compatible with Iterable. |
|
Mixin to prevent iteration, without being compatible with Iterable. |
|
Mixin to prevent iteration, without being compatible with Iterable. |
|
Mixin to prevent iteration, without being compatible with Iterable. |
|
A unicode string. |
|
Mixin to prevent iteration, without being compatible with Iterable. |
|
Unsigned integer type, compatible with C |
|
Unsigned integer type, compatible with C |
|
Unsigned signed integer type, 64bit on 64bit systems and 32bit on 32bit systems. |
|
Unsigned integer type, compatible with C |
Functions¶
|
Determine whether a value of one dtype can be safely cast to another, |
|
Cast a value to a type. |
|
Normalize a dtype-like input into an Arkouda dtype sentinel or a NumPy dtype. |
|
Returns dtype() for the given Chapel type. |
|
Get a concrete byteorder (turns '=' into '<' or '>') on the client. |
|
Get the server's byteorder. |
|
Whether a scalar is an arkouda supported boolean dtype. |
|
Whether a scalar is an arkouda supported dtype. |
|
Whether a scalar is an arkouda supported float dtype. |
|
Whether a scalar is an arkouda supported integer dtype. |
|
Whether a scalar is an arkouda supported numeric dtype. |
|
Try to infer what dtype arkouda_server should treat val as. |
|
Determine the result dtype from one or more inputs, following NumPy’s |
Module Contents¶
- class arkouda.numpy.dtypes.ARKOUDA_SUPPORTED_BOOLS¶
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class arkouda.numpy.dtypes.ARKOUDA_SUPPORTED_DTYPES¶
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class arkouda.numpy.dtypes.ARKOUDA_SUPPORTED_FLOATS¶
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class arkouda.numpy.dtypes.ARKOUDA_SUPPORTED_INTS¶
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class arkouda.numpy.dtypes.ARKOUDA_SUPPORTED_NUMBERS¶
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class arkouda.numpy.dtypes.BoolDType¶
Bases:
numpy.dtypeBoolDType() –
DType class corresponding to the numpy.bool scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.ByteDType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeInt8DType() –
DType class corresponding to the numpy.int8 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.BytesDType¶
Bases:
numpy.dtypeBytesDType(size, /) –
DType class corresponding to the numpy.bytes_ scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.CLongDoubleDType¶
Bases:
numpy.dtypes._ComplexAbstractDTypeCLongDoubleDType() –
DType class corresponding to the numpy.clongdouble scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.CastingKind(origin, args, *, inst=True, name=None)¶
Bases:
_GenericAliasThe central part of the internal API.
This represents a generic version of type ‘origin’ with type arguments ‘params’. There are two kind of these aliases: user defined and special. The special ones are wrappers around builtin collections and ABCs in collections.abc. These must have ‘name’ always set. If ‘inst’ is False, then the alias can’t be instantiated; this is used by e.g. typing.List and typing.Dict.
- class arkouda.numpy.dtypes.Complex128DType¶
Bases:
numpy.dtypes._ComplexAbstractDTypeComplex128DType() –
DType class corresponding to the numpy.complex128 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.Complex64DType¶
Bases:
numpy.dtypes._ComplexAbstractDTypeComplex64DType() –
DType class corresponding to the numpy.complex64 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.DType[source]¶
- BIGINT(*args, **kwargs)¶
- BOOL(*args, **kwargs)¶
- COMPLEX128(*args, **kwargs)¶
- COMPLEX64(*args, **kwargs)¶
- FLOAT(*args, **kwargs)¶
- FLOAT32(*args, **kwargs)¶
- FLOAT64(*args, **kwargs)¶
- INT(*args, **kwargs)¶
- INT16(*args, **kwargs)¶
- INT32(*args, **kwargs)¶
- INT64(*args, **kwargs)¶
- INT8(*args, **kwargs)¶
- STR(*args, **kwargs)¶
- UINT(*args, **kwargs)¶
- UINT16(*args, **kwargs)¶
- UINT32(*args, **kwargs)¶
- UINT64(*args, **kwargs)¶
- UINT8(*args, **kwargs)¶
- name(*args, **kwargs)¶
The name of the Enum member.
- value(*args, **kwargs)¶
The value of the Enum member.
- class arkouda.numpy.dtypes.DTypeObjects¶
Build an immutable unordered collection of unique elements.
- copy()¶
Return a shallow copy of a set.
- difference(*others)¶
Return a new set with elements in the set that are not in the others.
- intersection(*others)¶
Return a new set with elements common to the set and all others.
- isdisjoint(other, /)¶
Return True if two sets have a null intersection.
- issubset(other, /)¶
Report whether another set contains this set.
- issuperset(other, /)¶
Report whether this set contains another set.
- symmetric_difference(other, /)¶
Return a new set with elements in either the set or other but not both.
- union(*others)¶
Return a new set with elements from the set and all others.
- class arkouda.numpy.dtypes.DTypes¶
Build an immutable unordered collection of unique elements.
- copy()¶
Return a shallow copy of a set.
- difference(*others)¶
Return a new set with elements in the set that are not in the others.
- intersection(*others)¶
Return a new set with elements common to the set and all others.
- isdisjoint(other, /)¶
Return True if two sets have a null intersection.
- issubset(other, /)¶
Report whether another set contains this set.
- issuperset(other, /)¶
Report whether this set contains another set.
- symmetric_difference(other, /)¶
Return a new set with elements in either the set or other but not both.
- union(*others)¶
Return a new set with elements from the set and all others.
- class arkouda.numpy.dtypes.DateTime64DType¶
Bases:
numpy.dtypeDateTime64DType(unit, /) –
DType class corresponding to the numpy.datetime64 scalar type.
Warning
np.dtypes.DateTime64DTypecannot be instantiated directly. Usenp.dtype("datetime64[{unit}]")instead.See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.Enum[source]¶
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- class arkouda.numpy.dtypes.Float16DType¶
Bases:
numpy.dtypes._FloatAbstractDTypeFloat16DType() –
DType class corresponding to the numpy.float16 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.Float32DType¶
Bases:
numpy.dtypes._FloatAbstractDTypeFloat32DType() –
DType class corresponding to the numpy.float32 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.Float64DType¶
Bases:
numpy.dtypes._FloatAbstractDTypeFloat64DType() –
DType class corresponding to the numpy.float64 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.Int16DType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeInt16DType() –
DType class corresponding to the numpy.int16 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.Int32DType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeInt32DType() –
DType class corresponding to the numpy.int32 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.Int64DType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeInt64DType() –
DType class corresponding to the numpy.int64 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.Int8DType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeInt8DType() –
DType class corresponding to the numpy.int8 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.IntDType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeInt32DType() –
DType class corresponding to the numpy.int32 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.Literal(getitem)[source]¶
Bases:
_SpecialFormSpecial typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding variable or function parameter has a value equivalent to the provided literal (or one of several literals):
def\ validate_simple(data: Any) -> Literal[True]: # always returns True ... MODE = Literal['r', 'rb', 'w', 'wb'] def\ open_helper(file: str, mode: MODE) -> str: ... open_helper('/some/path', 'r') # Passes type check open_helper('/other/path', 'typo') # Error in type checker
Literal[…] cannot be subclassed. At runtime, an arbitrary value is allowed as type argument to Literal[…], but type checkers may impose restrictions.
- class arkouda.numpy.dtypes.LongDType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeInt64DType() –
DType class corresponding to the numpy.int64 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.LongDoubleDType¶
Bases:
numpy.dtypes._FloatAbstractDTypeLongDoubleDType() –
DType class corresponding to the numpy.longdouble scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.LongLongDType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeLongLongDType() –
DType class corresponding to the numpy.longlong scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.NUMBER_FORMAT_STRINGS¶
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- clear()¶
Remove all items from the dict.
- copy()¶
Return a shallow copy of the dict.
- fromkeys(iterable, value=None, /)¶
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)¶
Return the value for key if key is in the dictionary, else default.
- items()¶
Return a set-like object providing a view on the dict’s items.
- keys()¶
Return a set-like object providing a view on the dict’s keys.
- pop(*args, **kwargs)¶
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()¶
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)¶
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update(*args, **kwargs)¶
D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()¶
Return an object providing a view on the dict’s values.
- class arkouda.numpy.dtypes.NumericDTypes¶
Build an immutable unordered collection of unique elements.
- copy()¶
Return a shallow copy of a set.
- difference(*others)¶
Return a new set with elements in the set that are not in the others.
- intersection(*others)¶
Return a new set with elements common to the set and all others.
- isdisjoint(other, /)¶
Return True if two sets have a null intersection.
- issubset(other, /)¶
Report whether another set contains this set.
- issuperset(other, /)¶
Report whether this set contains another set.
- symmetric_difference(other, /)¶
Return a new set with elements in either the set or other but not both.
- union(*others)¶
Return a new set with elements from the set and all others.
- class arkouda.numpy.dtypes.ObjectDType¶
Bases:
numpy.dtypeObjectDType() –
DType class corresponding to the numpy.object scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.Optional[source]¶
Bases:
_FinalOptional[X] is equivalent to Union[X, None].
- class arkouda.numpy.dtypes.ScalarDTypes¶
Build an immutable unordered collection of unique elements.
- copy()¶
Return a shallow copy of a set.
- difference(*others)¶
Return a new set with elements in the set that are not in the others.
- intersection(*others)¶
Return a new set with elements common to the set and all others.
- isdisjoint(other, /)¶
Return True if two sets have a null intersection.
- issubset(other, /)¶
Report whether another set contains this set.
- issuperset(other, /)¶
Report whether this set contains another set.
- symmetric_difference(other, /)¶
Return a new set with elements in either the set or other but not both.
- union(*others)¶
Return a new set with elements from the set and all others.
- class arkouda.numpy.dtypes.SeriesDTypes¶
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- clear()¶
Remove all items from the dict.
- copy()¶
Return a shallow copy of the dict.
- fromkeys(iterable, value=None, /)¶
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)¶
Return the value for key if key is in the dictionary, else default.
- items()¶
Return a set-like object providing a view on the dict’s items.
- keys()¶
Return a set-like object providing a view on the dict’s keys.
- pop(*args, **kwargs)¶
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()¶
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)¶
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update(*args, **kwargs)¶
D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()¶
Return an object providing a view on the dict’s values.
- class arkouda.numpy.dtypes.ShortDType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeInt16DType() –
DType class corresponding to the numpy.int16 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.StrDType¶
Bases:
numpy.dtypeStrDType(size, /) –
DType class corresponding to the numpy.str_ scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.TimeDelta64DType¶
Bases:
numpy.dtypeTimeDelta64DType(unit, /) –
DType class corresponding to the numpy.timedelta64 scalar type.
Warning
np.dtypes.TimeDelta64DTypecannot be instantiated directly. Usenp.dtype("timedelta64[{unit}]")instead.See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.TypeAlias[source]¶
Bases:
_FinalSpecial form for marking type aliases.
Use TypeAlias to indicate that an assignment should be recognized as a proper type alias definition by type checkers.
For example:
Predicate: TypeAlias = Callable[..., bool]
It’s invalid when used anywhere except as in the example above.
- class arkouda.numpy.dtypes.TypeGuard[source]¶
Bases:
_FinalSpecial typing construct for marking user-defined type predicate functions.
TypeGuardcan be used to annotate the return type of a user-defined type predicate function.TypeGuardonly accepts a single type argument. At runtime, functions marked this way should return a boolean.TypeGuardaims to benefit type narrowing – a technique used by static type checkers to determine a more precise type of an expression within a program’s code flow. Usually type narrowing is done by analyzing conditional code flow and applying the narrowing to a block of code. The conditional expression here is sometimes referred to as a “type predicate”.Sometimes it would be convenient to use a user-defined boolean function as a type predicate. Such a function should use
TypeGuard[...]orTypeIs[...]as its return type to alert static type checkers to this intention.TypeGuardshould be used overTypeIswhen narrowing from an incompatible type (e.g.,list[object]tolist[int]) or when the function does not returnTruefor all instances of the narrowed type.Using
-> TypeGuard[NarrowedType]tells the static type checker that for a given function:The return value is a boolean.
If the return value is
True, the type of its argument isNarrowedType.
For example:
def\ is_str_list(val: list[object]) -> TypeGuard[list[str]]: '''Determines whether all objects in the list are strings''' return all(isinstance(x, str) for x in val) def\ func1(val: list[object]): if is_str_list(val): # Type of ``val`` is narrowed to ``list[str]``. print(" ".join(val)) else: # Type of ``val`` remains as ``list[object]``. print("Not a list of strings!")
Strict type narrowing is not enforced –
TypeBneed not be a narrower form ofTypeA(it can even be a wider form) and this may lead to type-unsafe results. The main reason is to allow for things like narrowinglist[object]tolist[str]even though the latter is not a subtype of the former, sincelistis invariant. The responsibility of writing type-safe type predicates is left to the user.TypeGuardalso works with type variables. For more information, see PEP 647 (User-Defined Type Guards).
- class arkouda.numpy.dtypes.UByteDType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeUInt8DType() –
DType class corresponding to the numpy.uint8 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.UInt16DType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeUInt16DType() –
DType class corresponding to the numpy.uint16 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.UInt32DType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeUInt32DType() –
DType class corresponding to the numpy.uint32 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.UInt64DType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeUInt64DType() –
DType class corresponding to the numpy.uint64 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.UInt8DType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeUInt8DType() –
DType class corresponding to the numpy.uint8 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.UIntDType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeUInt32DType() –
DType class corresponding to the numpy.uint32 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.ULongDType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeUInt64DType() –
DType class corresponding to the numpy.uint64 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.ULongLongDType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeULongLongDType() –
DType class corresponding to the numpy.ulonglong scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.UShortDType¶
Bases:
numpy.dtypes._IntegerAbstractDTypeUInt16DType() –
DType class corresponding to the numpy.uint16 scalar type.
See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.Union[source]¶
Bases:
_FinalUnion type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator can also be used to denote unions; X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details: - The arguments must be types and there must be at least one. - None as an argument is a special case and is replaced by
type(None).
Unions of unions are flattened, e.g.:
assert Union[Union[int, str], float] == Union[int, str, float]
Unions of a single argument vanish, e.g.:
assert Union[int] == int # The constructor actually returns int
Redundant arguments are skipped, e.g.:
assert Union[int, str, int] == Union[int, str]
When comparing unions, the argument order is ignored, e.g.:
assert Union[int, str] == Union[str, int]
You cannot subclass or instantiate a union.
You can use Optional[X] as a shorthand for Union[X, None].
- class arkouda.numpy.dtypes.VoidDType¶
Bases:
numpy.dtypeVoidDType(length, /) –
DType class corresponding to the numpy.void scalar type.
Warning
np.dtypes.VoidDTypecannot be instantiated directly. Usenp.dtype("void[{unit}]")instead.See numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.dtypes.all_scalars¶
Bases:
_NotIterableMixin to prevent iteration, without being compatible with Iterable.
That is, we could do:
def __iter__(self): raise TypeError()
But this would make users of this mixin duck type-compatible with collections.abc.Iterable - isinstance(foo, Iterable) would be True.
Luckily, we can instead prevent iteration by setting __iter__ to None, which is treated specially.
- copy_with(params)¶
- class arkouda.numpy.dtypes.annotations¶
- compiler_flag(*args, **kwargs)¶
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4
- getMandatoryRelease()¶
Return release in which this feature will become mandatory.
This is a 5-tuple, of the same form as sys.version_info, or, if the feature was dropped, or the release date is undetermined, is None.
- getOptionalRelease()¶
Return first release in which this feature was recognized.
This is a 5-tuple, of the same form as sys.version_info.
- mandatory(*args, **kwargs)¶
The type of the None singleton.
- optional(*args, **kwargs)¶
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
- class arkouda.numpy.dtypes.bigint[source]¶
Dtype sentinel for Arkouda’s variable-width (arbitrary-precision) integers.
This class represents the dtype object used by Arkouda arrays storing arbitrary-precision integers. It behaves similarly to NumPy’s dtype objects (such as
np.int64), but corresponds to an unbounded, variable-width integer type. Instances ofbigintare singletons created through__new__so that all dtype references share the same object.Construction semantics follow NumPy’s pattern: calling
ak.bigint()returns the dtype sentinel, and callingak.bigint(value)returns abigint_scalar constructed fromvalue.bigint instances compare equal to the
bigintclass, to themselves, to strings such as"bigint", and to other dtype-like objects whosenameattribute equals"bigint". This allows interoperability across Arkouda’s dtype-resolution system.Notes
This class represents only the dtype. Scalar values use
bigint_, which inherits fromint.- itemsize¶
Nominal bit-width (128). Actual precision is unbounded.
- Type:
int
- ndim¶
Number of dimensions for the dtype object (always 0).
- Type:
int
- shape¶
Empty tuple, following NumPy’s dtype API.
- Type:
tuple
Examples
>>> import arkouda as ak >>> ak.bigint() dtype(bigint)
>>> ak.bigint(42) ak.bigint_(42)
>>> dtype = ak.bigint() >>> dtype.name 'bigint'
- property is_signed¶
- property is_variable_width¶
- itemsize(*args, **kwargs)¶
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4
- kind(*args, **kwargs)¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to ‘utf-8’. errors defaults to ‘strict’.
- name(*args, **kwargs)¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to ‘utf-8’. errors defaults to ‘strict’.
- ndim(*args, **kwargs)¶
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating-point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4
- shape(*args, **kwargs)¶
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
- class arkouda.numpy.dtypes.bigint_[source]¶
Scalar type for Arkouda’s variable-width integer dtype.
bigint_represents an individual arbitrary-precision integer value within Arkouda arrays that use thebigintdtype. It inherits directly from Python’s built-inint, ensuring full arbitrary-precision semantics while providing dtype metadata compatible with Arkouda.This class is typically constructed indirectly via
ak.bigint(value), which invokes the_BigIntMetametaclass. Direct instantiation is also supported.Construction¶
bigint_(x)convertsxto an integer using Python’sint:If
xisstrorbytes, it is interpreted usingint(x, 0), allowing hexadecimal ("0xff"), binary ("0b1010"), and other literal forms.Otherwise,
xis passed directly toint(x).
Properties¶
- dtypebigint
Returns the corresponding dtype sentinel,
ak.bigint(). This mirrors NumPy scalar behavior (e.g.,np.int64(1).dtype).
Notes
bigint_values behave exactly like Pythonintobjects in arithmetic, hashing, comparison, and formatting. Arkouda arrays wrap and distribute many such scalars but do not impose fixed-width limits.Examples
>>> import arkouda as ak >>> x = ak.bigint(123) >>> x ak.bigint_(123)
>>> x + 10 133
>>> ak.bigint_("0xff") ak.bigint_(255)
>>> x.dtype dtype(bigint)
>>> x.item() 123
- property dtype¶
- class arkouda.numpy.dtypes.bitType¶
Bases:
numpy.unsignedintegerUnsigned signed integer type, 64bit on 64bit systems and 32bit on 32bit systems.
- Character code:
'L'- Canonical name:
numpy.uint
- Alias on this platform (Linux x86_64):
numpy.uint64: 64-bit unsigned integer (
0to18_446_744_073_709_551_615).- Alias on this platform (Linux x86_64):
numpy.uintp: Unsigned integer large enough to fit pointer, compatible with C
uintptr_t.
- bit_count(/)¶
uint64.bit_count() -> int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcountin C++.Examples
>>> np.uint64(127).bit_count() 7
- class arkouda.numpy.dtypes.bool¶
Bases:
numpy.genericBoolean type (True or False), stored as a byte.
Warning
The
booltype is not a subclass of theint_type (theboolis not even a number type). This is different than Python’s default implementation ofboolas a sub-class ofint.- Character code:
'?'
- class arkouda.numpy.dtypes.bool_¶
Bases:
numpy.genericBoolean type (True or False), stored as a byte.
Warning
The
booltype is not a subclass of theint_type (theboolis not even a number type). This is different than Python’s default implementation ofboolas a sub-class ofint.- Character code:
'?'
- class arkouda.numpy.dtypes.bool_scalars¶
Bases:
_NotIterableMixin to prevent iteration, without being compatible with Iterable.
That is, we could do:
def __iter__(self): raise TypeError()
But this would make users of this mixin duck type-compatible with collections.abc.Iterable - isinstance(foo, Iterable) would be True.
Luckily, we can instead prevent iteration by setting __iter__ to None, which is treated specially.
- copy_with(params)¶
- arkouda.numpy.dtypes.can_cast(from_dt, to_dt, casting: Literal['safe'] | None = 'safe') bool[source]¶
Determine whether a value of one dtype can be safely cast to another, following NumPy-like rules but including Arkouda-specific handling for
bigintandbigint_.The default
"safe"mode uses the following logic:bigint→bigint: always allowed.bigint→ float dtypes: allowed (may lose precision, but magnitude fits).bigint→ fixed-width signed/unsigned integers: not allowed, due to potential overflow.int64 / uint64 →
bigint: allowed (widening).float →
bigint: not allowed (information loss).All other cases fall back to
numpy.can_castsemantics.
- Parameters:
from_dt (Any) – Source dtype or scalar-like object.
to_dt (Any) – Target dtype or scalar-like object.
casting (str, optional) – Casting rule, matching NumPy’s
can_castAPI. Only"safe"is currently implemented. Other values are accepted for API compatibility but routed through the same logic.
Examples
>>> import arkouda as ak >>> from arkouda.numpy import can_cast, dtype
# bigint → bigint >>> can_cast(dtype(“bigint”), dtype(“bigint”)) True
# bigint → float64 >>> can_cast(dtype(“bigint”), dtype(“float64”)) True
# bigint → int64 (unsafe) >>> can_cast(dtype(“bigint”), dtype(“int64”)) False
# int64 → bigint (widening) >>> can_cast(dtype(“int64”), dtype(“bigint”)) True
# float → bigint (lossy) >>> can_cast(dtype(“float64”), dtype(“bigint”)) False
# Standard NumPy cases >>> can_cast(dtype(“int64”), dtype(“float64”)) True >>> can_cast(dtype(“float64”), dtype(“int64”)) False
- arkouda.numpy.dtypes.cast(typ, val)[source]¶
Cast a value to a type.
This returns the value unchanged. To the type checker this signals that the return value has the designated type, but at runtime we intentionally don’t check anything (we want this to be as fast as possible).
- class arkouda.numpy.dtypes.complex128¶
Bases:
numpy.complexfloatingComplex number type composed of two double-precision floating-point numbers, compatible with Python
complex.- Character code:
'D'- Canonical name:
numpy.cdouble
- Alias on this platform (Linux x86_64):
numpy.complex128: Complex number type composed of 2 64-bit-precision floating-point numbers.
- class arkouda.numpy.dtypes.complex64¶
Bases:
numpy.complexfloatingComplex number type composed of two single-precision floating-point numbers.
- Character code:
'F'- Canonical name:
numpy.csingle
- Alias on this platform (Linux x86_64):
numpy.complex64: Complex number type composed of 2 32-bit-precision floating-point numbers.
- arkouda.numpy.dtypes.dtype(x)[source]¶
Normalize a dtype-like input into an Arkouda dtype sentinel or a NumPy dtype.
This function accepts many dtype-like forms—including Python scalars, NumPy scalar types, Arkouda
bigintsentinels, and strings—and resolves them to the canonical Arkouda/NumPy dtype object. The resolution rules include special handling of thebigintfamily and magnitude-aware routing for Python integers.- Parameters:
x (Any) – The dtype-like object to normalize. May be a Python scalar, a NumPy dtype or scalar, the
bigintsentinel or scalar, a dtype-specifying string, or any object accepted bynumpy.dtype.- Raises:
TypeError – If
xcannot be interpreted as either an Arkouda dtype or a NumPy dtype. This includes cases wherenumpy.dtype(x)itself fails.
Examples
>>> import arkouda as ak >>> from arkouda.numpy import dtype
# bigint family >>> dtype(“bigint”) dtype(bigint) >>> dtype(ak.bigint(10_000_000_000_000_000_000)) dtype(bigint)
# magnitude-based routing for Python ints >>> dtype(10) dtype(‘int64’) >>> dtype(2**63 - 1) dtype(‘int64’) >>> dtype(2**63) dtype(‘uint64’) >>> dtype(2**100) dtype(bigint)
# floats and bools >>> dtype(1.0) dtype(‘float64’) >>> dtype(True) dtype(‘bool’)
# string dtypes >>> dtype(“str”) dtype(‘<U’)
# fallback to numpy.dtype >>> dtype(“int32”) dtype(‘int32’)
- arkouda.numpy.dtypes.dtype_for_chapel(type_name: str)[source]¶
Returns dtype() for the given Chapel type.
- class arkouda.numpy.dtypes.float16¶
Bases:
numpy.floatingHalf-precision floating-point number type.
- Character code:
'e'- Canonical name:
numpy.half
- Alias on this platform (Linux x86_64):
numpy.float16: 16-bit-precision floating-point number type: sign bit, 5 bits exponent, 10 bits mantissa.
- as_integer_ratio(/)¶
half.as_integer_ratio() -> (int, int)
Return a pair of integers, whose ratio is exactly equal to the original floating point number, and with a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs.
>>> np.half(10.0).as_integer_ratio() (10, 1) >>> np.half(0.0).as_integer_ratio() (0, 1) >>> np.half(-.25).as_integer_ratio() (-1, 4)
- is_integer(/)¶
half.is_integer() -> bool
Return
Trueif the floating point number is finite with integral value, andFalseotherwise.Added in version 1.22.
Examples
>>> np.half(-2.0).is_integer() True >>> np.half(3.2).is_integer() False
- class arkouda.numpy.dtypes.float32¶
Bases:
numpy.floatingSingle-precision floating-point number type, compatible with C
float.- Character code:
'f'- Canonical name:
numpy.single
- Alias on this platform (Linux x86_64):
numpy.float32: 32-bit-precision floating-point number type: sign bit, 8 bits exponent, 23 bits mantissa.
- as_integer_ratio(/)¶
single.as_integer_ratio() -> (int, int)
Return a pair of integers, whose ratio is exactly equal to the original floating point number, and with a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs.
>>> np.single(10.0).as_integer_ratio() (10, 1) >>> np.single(0.0).as_integer_ratio() (0, 1) >>> np.single(-.25).as_integer_ratio() (-1, 4)
- is_integer(/)¶
single.is_integer() -> bool
Return
Trueif the floating point number is finite with integral value, andFalseotherwise.Added in version 1.22.
Examples
>>> np.single(-2.0).is_integer() True >>> np.single(3.2).is_integer() False
- class arkouda.numpy.dtypes.float64¶
Bases:
numpy.floatingDouble-precision floating-point number type, compatible with Python
floatand Cdouble.- Character code:
'd'- Canonical name:
numpy.double
- Alias on this platform (Linux x86_64):
numpy.float64: 64-bit precision floating-point number type: sign bit, 11 bits exponent, 52 bits mantissa.
- as_integer_ratio(/)¶
double.as_integer_ratio() -> (int, int)
Return a pair of integers, whose ratio is exactly equal to the original floating point number, and with a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs.
>>> np.double(10.0).as_integer_ratio() (10, 1) >>> np.double(0.0).as_integer_ratio() (0, 1) >>> np.double(-.25).as_integer_ratio() (-1, 4)
- fromhex(string, /)¶
Create a floating-point number from a hexadecimal string.
>>> float.fromhex('0x1.ffffp10') 2047.984375 >>> float.fromhex('-0x1p-1074') -5e-324
- hex(/)¶
Return a hexadecimal representation of a floating-point number.
>>> (-0.1).hex() '-0x1.999999999999ap-4' >>> 3.14159.hex() '0x1.921f9f01b866ep+1'
- is_integer(/)¶
double.is_integer() -> bool
Return
Trueif the floating point number is finite with integral value, andFalseotherwise.Added in version 1.22.
Examples
>>> np.double(-2.0).is_integer() True >>> np.double(3.2).is_integer() False
- class arkouda.numpy.dtypes.float_scalars¶
Bases:
_NotIterableMixin to prevent iteration, without being compatible with Iterable.
That is, we could do:
def __iter__(self): raise TypeError()
But this would make users of this mixin duck type-compatible with collections.abc.Iterable - isinstance(foo, Iterable) would be True.
Luckily, we can instead prevent iteration by setting __iter__ to None, which is treated specially.
- copy_with(params)¶
- arkouda.numpy.dtypes.get_byteorder(dt: np.dtype) str[source]¶
Get a concrete byteorder (turns ‘=’ into ‘<’ or ‘>’) on the client.
- Parameters:
dt (np.dtype) – The numpy dtype to determine the byteorder of.
- Returns:
Returns “<” for little endian and “>” for big endian.
- Return type:
- Raises:
ValueError – Returned if sys.byteorder is not “little” or “big”
Examples
>>> import arkouda as ak >>> ak.get_byteorder(ak.dtype(ak.int64)) '<'
- arkouda.numpy.dtypes.get_server_byteorder() str[source]¶
Get the server’s byteorder.
- Returns:
Returns “little” for little endian and “big” for big endian.
- Return type:
- Raises:
ValueError – Raised if Server byteorder is not ‘little’ or ‘big’
Examples
>>> import arkouda as ak >>> ak.get_server_byteorder() 'little'
- class arkouda.numpy.dtypes.int16¶
Bases:
numpy.signedintegerSigned integer type, compatible with C
short.- Character code:
'h'- Canonical name:
numpy.short
- Alias on this platform (Linux x86_64):
numpy.int16: 16-bit signed integer (
-32_768to32_767).
- bit_count(/)¶
int16.bit_count() -> int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcountin C++.Examples
>>> np.int16(127).bit_count() 7 >>> np.int16(-127).bit_count() 7
- class arkouda.numpy.dtypes.int32¶
Bases:
numpy.signedintegerSigned integer type, compatible with C
int.- Character code:
'i'- Canonical name:
numpy.intc
- Alias on this platform (Linux x86_64):
numpy.int32: 32-bit signed integer (
-2_147_483_648to2_147_483_647).
- bit_count(/)¶
int32.bit_count() -> int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcountin C++.Examples
>>> np.int32(127).bit_count() 7 >>> np.int32(-127).bit_count() 7
- class arkouda.numpy.dtypes.int64¶
Bases:
numpy.signedintegerSigned integer type, compatible with C
long.- Character code:
'l'- Canonical name:
numpy.long
- Alias on this platform (Linux x86_64):
numpy.int64: 64-bit signed integer (
-9_223_372_036_854_775_808to9_223_372_036_854_775_807).- Alias on this platform (Linux x86_64):
numpy.intp: Signed integer large enough to fit pointer, compatible with C
intptr_t.
- bit_count(/)¶
int64.bit_count() -> int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcountin C++.Examples
>>> np.int64(127).bit_count() 7 >>> np.int64(-127).bit_count() 7
- class arkouda.numpy.dtypes.int8¶
Bases:
numpy.signedintegerSigned integer type, compatible with C
char.- Character code:
'b'- Canonical name:
numpy.byte
- Alias on this platform (Linux x86_64):
numpy.int8: 8-bit signed integer (
-128to127).
- bit_count(/)¶
int8.bit_count() -> int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcountin C++.Examples
>>> np.int8(127).bit_count() 7 >>> np.int8(-127).bit_count() 7
- class arkouda.numpy.dtypes.intTypes¶
Build an immutable unordered collection of unique elements.
- copy()¶
Return a shallow copy of a set.
- difference(*others)¶
Return a new set with elements in the set that are not in the others.
- intersection(*others)¶
Return a new set with elements common to the set and all others.
- isdisjoint(other, /)¶
Return True if two sets have a null intersection.
- issubset(other, /)¶
Report whether another set contains this set.
- issuperset(other, /)¶
Report whether this set contains another set.
- symmetric_difference(other, /)¶
Return a new set with elements in either the set or other but not both.
- union(*others)¶
Return a new set with elements from the set and all others.
- class arkouda.numpy.dtypes.int_scalars¶
Bases:
_NotIterableMixin to prevent iteration, without being compatible with Iterable.
That is, we could do:
def __iter__(self): raise TypeError()
But this would make users of this mixin duck type-compatible with collections.abc.Iterable - isinstance(foo, Iterable) would be True.
Luckily, we can instead prevent iteration by setting __iter__ to None, which is treated specially.
- copy_with(params)¶
- arkouda.numpy.dtypes.is_supported_bool(num) TypeGuard[bool_scalars][source]¶
Whether a scalar is an arkouda supported boolean dtype.
- Parameters:
num (object) – A scalar.
- Returns:
True if scalar is an instance of an arkouda supported boolean dtype, else False.
- Return type:
Examples
>>> import arkouda as ak >>> ak.is_supported_bool("True") False >>> ak.is_supported_bool(True) True
- arkouda.numpy.dtypes.is_supported_dtype(scalar: object) bool[source]¶
Whether a scalar is an arkouda supported dtype.
- Parameters:
scalar (object)
- Returns:
True if scalar is an instance of an arkouda supported dtype, else False.
- Return type:
builtins.bool
Examples
>>> import arkouda as ak >>> ak.is_supported_dtype(ak.int64(64)) True >>> ak.is_supported_dtype(np.complex128(1+2j)) False
- arkouda.numpy.dtypes.is_supported_float(num) TypeGuard[float_scalars][source]¶
Whether a scalar is an arkouda supported float dtype.
- Parameters:
num (object) – A scalar.
- Returns:
True if scalar is an instance of an arkouda supported float dtype, else False.
- Return type:
Examples
>>> import arkouda as ak >>> ak.is_supported_float(56) False >>> ak.is_supported_float(56.7) True
- arkouda.numpy.dtypes.is_supported_int(num) TypeGuard[int_scalars][source]¶
Whether a scalar is an arkouda supported integer dtype.
- Parameters:
num (object) – A scalar.
- Returns:
True if scalar is an instance of an arkouda supported integer dtype, else False.
- Return type:
Examples
>>> import arkouda as ak >>> ak.is_supported_int(79) True >>> ak.is_supported_int(54.9) False
- arkouda.numpy.dtypes.is_supported_number(num) TypeGuard[numeric_scalars][source]¶
Whether a scalar is an arkouda supported numeric dtype.
- Parameters:
num (object) – A scalar.
- Returns:
True if scalar is an instance of an arkouda supported numeric dtype, else False.
- Return type:
Examples
>>> import arkouda as ak >>> ak.is_supported_number(45.9) True >>> ak.is_supported_number("string") False
- class arkouda.numpy.dtypes.numeric_and_bool_scalars¶
Bases:
_NotIterableMixin to prevent iteration, without being compatible with Iterable.
That is, we could do:
def __iter__(self): raise TypeError()
But this would make users of this mixin duck type-compatible with collections.abc.Iterable - isinstance(foo, Iterable) would be True.
Luckily, we can instead prevent iteration by setting __iter__ to None, which is treated specially.
- copy_with(params)¶
- class arkouda.numpy.dtypes.numeric_scalars¶
Bases:
_NotIterableMixin to prevent iteration, without being compatible with Iterable.
That is, we could do:
def __iter__(self): raise TypeError()
But this would make users of this mixin duck type-compatible with collections.abc.Iterable - isinstance(foo, Iterable) would be True.
Luckily, we can instead prevent iteration by setting __iter__ to None, which is treated specially.
- copy_with(params)¶
- class arkouda.numpy.dtypes.numpy_scalars¶
Bases:
_NotIterableMixin to prevent iteration, without being compatible with Iterable.
That is, we could do:
def __iter__(self): raise TypeError()
But this would make users of this mixin duck type-compatible with collections.abc.Iterable - isinstance(foo, Iterable) would be True.
Luckily, we can instead prevent iteration by setting __iter__ to None, which is treated specially.
- copy_with(params)¶
- arkouda.numpy.dtypes.resolve_scalar_dtype(val: object) str[source]¶
Try to infer what dtype arkouda_server should treat val as.
- arkouda.numpy.dtypes.result_type(*args)[source]¶
Determine the result dtype from one or more inputs, following NumPy’s promotion rules but extended to support Arkouda
bigintsemantics.This function mirrors
numpy.result_typefor standard NumPy dtypes, scalars, and arrays, but additionally recognizes Arkoudabigintandbigint_values, promoting them according to Arkouda-specific rules.In mixed-type expressions, the following logic is applied:
- Any presence of
bigintorbigint_promotes the result to: float64if any float is also present,otherwise
bigint.
- Any presence of
Python integers first pass through Arkouda’s magnitude-aware
dtype()routing, so extremely large integers may promote tobigint.Booleans promote to
boolas in NumPy.Mixed signed/unsigned integers follow NumPy rules, except that a non-negative signed scalar combined with unsigned scalars promotes to the widest unsigned dtype.
All remaining cases defer to
numpy.result_type.
- Parameters:
*args (Any) – One or more dtype-like objects, scalars, NumPy arrays, Arkouda arrays, or any value accepted by
numpy.result_typeor Arkouda’sdtype()conversion.
Examples
>>> import arkouda as ak >>> from arkouda.numpy import result_type, dtype
# bigint wins unless floats appear >>> result_type(dtype(“bigint”), dtype(“int64”)) dtype(bigint)
>>> result_type(dtype("bigint"), dtype("float64")) dtype('float64')
# magnitude-aware routing: this becomes bigint, so result is bigint >>> result_type(2**100, 5) dtype(bigint)
# standard NumPy integer promotions >>> result_type(dtype(“int32”), dtype(“int64”)) dtype(‘int64’)
# unsigned with non-negative signed scalar → largest unsigned >>> result_type(np.uint32(3), 7) # 7 is non-negative signed scalar dtype(‘uint32’)
# float promotion >>> result_type(1.0, 5) dtype(‘float64’)
# boolean stays boolean >>> result_type(True, False) dtype(‘bool’)
- class arkouda.numpy.dtypes.str_¶
A unicode string.
This type strips trailing null codepoints.
>>> s = np.str_("abc\x00") >>> s 'abc'
Unlike the builtin
str, this supports the python:bufferobjects, exposing its contents as UCS4:>>> m = memoryview(np.str_("abc")) >>> m.format '3w' >>> m.tobytes() b'a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00'
- Character code:
'U'
- T(*args, **kwargs)¶
Scalar attribute identical to ndarray.T.
- all(/, axis=None, out=None, keepdims=False, *, where=True)¶
Scalar method identical to ndarray.all.
- any(/, axis=None, out=None, keepdims=False, *, where=True)¶
Scalar method identical to ndarray.any.
- argmax(/, axis=None, out=None, *, keepdims=False)¶
Scalar method identical to ndarray.argmax.
- argmin(/, axis=None, out=None, *, keepdims=False)¶
Scalar method identical to ndarray.argmin.
- argsort(/, axis=-1, kind=None, order=None, *, stable=None)¶
Scalar method identical to ndarray.argsort.
- astype(/, dtype, order='K', casting='unsafe', subok=True, copy=True)¶
Scalar method identical to ndarray.astype.
- base(*args, **kwargs)¶
Scalar attribute identical to ndarray.base.
- byteswap(/, inplace=False)¶
Scalar method identical to ndarray.byteswap.
- choose(/, choices, out=None, mode='raise')¶
Scalar method identical to ndarray.choose.
- clip(/, min=None, max=None, out=None, **kwargs)¶
Scalar method identical to ndarray.clip.
- compress(/, condition, axis=None, out=None)¶
Scalar method identical to ndarray.compress.
- conj(/)¶
Scalar method identical to ndarray.conj.
- conjugate(/)¶
Scalar method identical to ndarray.conjugate.
- copy(/, order='C')¶
Scalar method identical to ndarray.copy.
- cumprod(/, axis=None, dtype=None, out=None)¶
Scalar method identical to ndarray.cumprod.
- cumsum(/, axis=None, dtype=None, out=None)¶
Scalar method identical to ndarray.cumsum.
- data(*args, **kwargs)¶
Pointer to start of data.
- device(*args, **kwargs)¶
- diagonal(/, offset=0, axis1=0, axis2=1)¶
Scalar method identical to ndarray.diagonal.
- dtype(*args, **kwargs)¶
Get array data-descriptor.
- dump(/, file)¶
Scalar method identical to ndarray.dump.
- dumps(/)¶
Scalar method identical to ndarray.dumps.
- fill(/, value)¶
Scalar method identical to ndarray.fill.
- flags(*args, **kwargs)¶
The integer value of flags.
- flat(*args, **kwargs)¶
A 1-D view of the scalar.
- flatten(/, order='C')¶
Scalar method identical to ndarray.flatten.
- getfield(/, dtype, offset=0)¶
Scalar method identical to ndarray.getfield.
- imag(*args, **kwargs)¶
The imaginary part of the scalar.
- item(/, *args)¶
Scalar method identical to ndarray.item.
- itemsize(*args, **kwargs)¶
The length of one element in bytes.
- max(/, axis=None, out=None, **kwargs)¶
Scalar method identical to ndarray.max.
- mean(/, axis=None, dtype=None, out=None, **kwargs)¶
Scalar method identical to ndarray.mean.
- min(/, axis=None, out=None, **kwargs)¶
Scalar method identical to ndarray.min.
- nbytes(*args, **kwargs)¶
- ndim(*args, **kwargs)¶
The number of array dimensions.
- nonzero(/)¶
Scalar method identical to ndarray.nonzero.
- prod(/, axis=None, dtype=None, out=None, **kwargs)¶
Scalar method identical to ndarray.prod.
- put(indices, values, /, mode='raise')¶
Scalar method identical to ndarray.put.
- ravel(/, order='C')¶
Scalar method identical to ndarray.ravel.
- real(*args, **kwargs)¶
The real part of the scalar.
- repeat(repeats, /, axis=None)¶
Scalar method identical to ndarray.repeat.
- reshape(/, *shape, order='C', copy=None)¶
Scalar method identical to ndarray.reshape.
- resize(/, *new_shape, refcheck=True)¶
Scalar method identical to ndarray.resize.
- round(/, decimals=0, out=None)¶
Scalar method identical to ndarray.round.
- searchsorted(v, /, side='left', sorter=None)¶
Scalar method identical to ndarray.searchsorted.
- setfield(val, /, dtype, offset=0)¶
Scalar method identical to ndarray.setfield.
- setflags(/, *, write=None, align=None, uic=None)¶
Scalar method identical to ndarray.setflags.
- shape(*args, **kwargs)¶
Tuple of array dimensions.
- size(*args, **kwargs)¶
The number of elements in the gentype.
- sort(/, axis=-1, kind=None, order=None, *, stable=None)¶
Scalar method identical to ndarray.sort.
- squeeze(/, axis=None)¶
Scalar method identical to ndarray.squeeze.
- std(/, axis=None, dtype=None, out=None, ddof=0, **kwargs)¶
Scalar method identical to ndarray.std.
- strides(*args, **kwargs)¶
Tuple of bytes steps in each dimension.
- sum(/, axis=None, dtype=None, out=None, **kwargs)¶
Scalar method identical to ndarray.sum.
- swapaxes(axis1, axis2, /)¶
Scalar method identical to ndarray.swapaxes.
- take(indices, /, axis=None, out=None, mode='raise')¶
Scalar method identical to ndarray.take.
- to_device(device, /, *, stream=None)¶
Scalar method identical to ndarray.to_device.
- tobytes(/, order='C')¶
Scalar method identical to ndarray.tobytes.
- tofile(fid, /, sep='', format='%s')¶
Scalar method identical to ndarray.tofile.
- tolist(/)¶
Scalar method identical to ndarray.tolist.
- trace(/, offset=0, axis1=0, axis2=1, dtype=None, out=None)¶
Scalar method identical to ndarray.trace.
- transpose(/, *axes)¶
Scalar method identical to ndarray.transpose.
- var(/, axis=None, dtype=None, out=None, ddof=0, **kwargs)¶
Scalar method identical to ndarray.var.
- view(/, *args, **kwargs)¶
Scalar method identical to ndarray.view.
- class arkouda.numpy.dtypes.str_scalars¶
Bases:
_NotIterableMixin to prevent iteration, without being compatible with Iterable.
That is, we could do:
def __iter__(self): raise TypeError()
But this would make users of this mixin duck type-compatible with collections.abc.Iterable - isinstance(foo, Iterable) would be True.
Luckily, we can instead prevent iteration by setting __iter__ to None, which is treated specially.
- copy_with(params)¶
- class arkouda.numpy.dtypes.uint16¶
Bases:
numpy.unsignedintegerUnsigned integer type, compatible with C
unsigned short.- Character code:
'H'- Canonical name:
numpy.ushort
- Alias on this platform (Linux x86_64):
numpy.uint16: 16-bit unsigned integer (
0to65_535).
- bit_count(/)¶
uint16.bit_count() -> int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcountin C++.Examples
>>> np.uint16(127).bit_count() 7
- class arkouda.numpy.dtypes.uint32¶
Bases:
numpy.unsignedintegerUnsigned integer type, compatible with C
unsigned int.- Character code:
'I'- Canonical name:
numpy.uintc
- Alias on this platform (Linux x86_64):
numpy.uint32: 32-bit unsigned integer (
0to4_294_967_295).
- bit_count(/)¶
uint32.bit_count() -> int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcountin C++.Examples
>>> np.uint32(127).bit_count() 7
- class arkouda.numpy.dtypes.uint64¶
Bases:
numpy.unsignedintegerUnsigned signed integer type, 64bit on 64bit systems and 32bit on 32bit systems.
- Character code:
'L'- Canonical name:
numpy.uint
- Alias on this platform (Linux x86_64):
numpy.uint64: 64-bit unsigned integer (
0to18_446_744_073_709_551_615).- Alias on this platform (Linux x86_64):
numpy.uintp: Unsigned integer large enough to fit pointer, compatible with C
uintptr_t.
- bit_count(/)¶
uint64.bit_count() -> int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcountin C++.Examples
>>> np.uint64(127).bit_count() 7
- class arkouda.numpy.dtypes.uint8¶
Bases:
numpy.unsignedintegerUnsigned integer type, compatible with C
unsigned char.- Character code:
'B'- Canonical name:
numpy.ubyte
- Alias on this platform (Linux x86_64):
numpy.uint8: 8-bit unsigned integer (
0to255).
- bit_count(/)¶
uint8.bit_count() -> int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcountin C++.Examples
>>> np.uint8(127).bit_count() 7