arkouda.numpy¶
Submodules¶
Attributes¶
Classes¶
frozenset() -> empty frozenset object |
|
Built-in immutable sequence. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
An enumeration. |
|
frozenset() -> empty frozenset object |
|
frozenset() -> empty frozenset object |
|
DataSource(destpath='.') |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
An enumeration. |
|
Boolean type (True or False), stored as a byte. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
dict() -> new empty dictionary |
|
frozenset() -> empty frozenset object |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
Issued by polyfit when the Vandermonde matrix is rank deficient. |
|
frozenset() -> empty frozenset object |
|
Built-in immutable sequence. |
|
dict() -> new empty dictionary |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
max_work was exceeded. |
|
Boolean type (True or False), stored as a byte. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
DType class corresponding to the scalar type and dtype of the same name. |
|
The central part of internal API. |
|
Unsigned integer type, compatible with C |
|
Boolean type (True or False), stored as a byte. |
|
The central part of internal API. |
|
Signed integer type, compatible with C |
|
A byte string. |
|
Complex number type composed of two double-precision floating-point |
|
Complex number type composed of two double-precision floating-point |
|
Abstract base class of all character string scalar types. |
|
Complex number type composed of two extended-precision floating-point |
|
Complex number type composed of two extended-precision floating-point |
|
Complex number type composed of two double-precision floating-point |
|
Complex number type composed of two single-precision floating-point |
|
Complex number type composed of two single-precision floating-point |
|
If created from a 64-bit integer, it represents an offset from |
|
Double-precision floating-point number type, compatible with Python float |
|
finfo(dtype) |
|
Abstract base class of all scalar types without predefined length. |
|
Half-precision floating-point number type. |
|
Single-precision floating-point number type, compatible with C |
|
Double-precision floating-point number type, compatible with Python float |
|
Double-precision floating-point number type, compatible with Python float |
|
The central part of internal API. |
|
Abstract base class of all floating-point scalar types. |
|
Class to convert formats, names, titles description to a dtype. |
|
Half-precision floating-point number type. |
|
iinfo(type) |
|
Abstract base class of all numeric scalar types with a (potentially) |
|
Signed integer type, compatible with C |
|
Signed integer type, compatible with C |
|
Signed integer type, compatible with Python int and C |
|
Signed integer type, compatible with C |
|
frozenset() -> empty frozenset object |
|
Signed integer type, compatible with Python int and C |
|
The central part of internal API. |
|
Signed integer type, compatible with C |
|
Abstract base class of all integer scalar types. |
|
Signed integer type, compatible with Python int and C |
|
Extended-precision floating-point number type, compatible with C |
|
Extended-precision floating-point number type, compatible with C |
|
Signed integer type, compatible with C |
|
Abstract base class of all numeric scalar types. |
|
The central part of internal API. |
|
The central part of internal API. |
|
The central part of internal API. |
|
Any Python object. |
|
dict() -> new empty dictionary |
|
dict() -> new empty dictionary |
|
Signed integer type, compatible with C |
|
Abstract base class of all signed integer scalar types. |
|
Single-precision floating-point number type, compatible with C |
|
A unicode string. |
|
The central part of internal API. |
|
A timedelta stored as a 64-bit integer. |
|
Unsigned integer type, compatible with C |
|
Unsigned integer type, compatible with C |
|
Unsigned integer type, compatible with C |
|
Unsigned integer type, compatible with C |
|
Unsigned integer type, compatible with C |
|
Unsigned integer type, compatible with C |
|
Unsigned integer type, compatible with C |
|
Unsigned integer type, compatible with C |
|
Signed integer type, compatible with C |
|
Abstract base class of all unsigned integer scalar types. |
|
Unsigned integer type, compatible with C |
|
np.void(length_or_data, /, dtype=None) |
Functions¶
|
Return the element-wise absolute value of the array. |
|
Add documentation to an existing object, typically one defined in C |
|
Return the element-wise inverse cosine of the array. The result is between 0 and pi. |
|
Return the element-wise inverse hyperbolic cosine of the array. |
|
Return the element-wise inverse sine of the array. The result is between -pi/2 and pi/2. |
|
Return the element-wise inverse hyperbolic sine of the array. |
|
Return the element-wise inverse tangent of the array. The result is between -pi/2 and pi/2. |
|
Return the element-wise inverse tangent of the array pair. The result chosen is the |
|
Return the element-wise inverse hyperbolic tangent of the array. |
|
Compares two pdarrays for equality. |
|
Return a string representation of a number in the given base system. |
|
Return the binary representation of the input number as a string. |
|
Cast an array to another dtype. |
|
Return the element-wise ceiling of the array. |
|
Clip (limit) the values in an array to a given range [lo,hi] |
|
Return the element-wise cosine of the array. |
|
Return the element-wise hyperbolic cosine of the array. |
|
Compute the nonzero count of a given array. 1D case only, for now. |
|
Return the cumulative product over the array. |
|
Return the cumulative sum over the array. |
|
Converts angles element-wise from degrees to radians. |
|
Issues a DeprecationWarning, adds warning to old_name's |
|
Deprecates a function and includes the deprecation in its docstring. |
|
Display a message on a device. |
|
|
|
Return the element-wise exponential of the array. |
|
Return the element-wise exponential of the array minus one. |
|
Return a pdarray with zeros everywhere except along a diagonal, which is all ones. |
|
Reverse an array's values along a particular axis or axes. |
|
Return the element-wise floor of the array. |
|
Format a floating-point scalar as a decimal string in positional notation. |
|
Format a floating-point scalar as a decimal string in scientific notation. |
|
Get a concrete byteorder (turns '=' into '<' or '>') |
|
Get the server's byteorder |
|
Return an element-wise hash of the array or list of arrays. |
|
Compute a histogram of evenly spaced bins over the range of an array. |
|
Compute the bi-dimensional histogram of two data samples with evenly spaced bins |
|
Compute the multidimensional histogram of data in sample with evenly spaced bins. |
|
|
|
|
|
|
|
|
|
|
|
Return the element-wise isfinite check applied to the array. |
|
Return the element-wise isinf check applied to the array. |
|
Return the element-wise isnan check applied to the array. |
|
Returns True if the type of element is a scalar type. |
|
Determines whether the given object represents a scalar data-type. |
|
Determine if a class is a subclass of a second class. |
|
Returns True if first argument is a typecode lower/equal in type hierarchy. |
|
Return the element-wise natural log of the array. |
|
Return the element-wise base 10 log of the array. |
|
Return the element-wise natural log of one plus the array. |
|
Return the element-wise base 2 log of the array. |
|
Compute the product of two matrices. |
Return the scalar type of highest precision of the same kind as the input. |
|
|
Compute the median of a given array. 1d case only, for now. |
|
Overwrites elements of A with elements from B based upon a mask array. |
|
Converts angles element-wise from radians to degrees. |
|
Try to infer what dtype arkouda_server should treat val as. |
|
Return the element-wise rounding of the array. |
|
Return the shape of an array. |
|
Return the element-wise sign of the array. |
|
Return the element-wise sine of the array. |
|
Return the element-wise hyperbolic sine of the array. |
|
Return the element-wise square of the array. |
|
Remove degenerate (size one) dimensions from an array. |
|
Return the element-wise tangent of the array. |
|
Return the element-wise hyperbolic tangent of the array. |
|
Compute the transpose of a matrix. |
|
Return a copy of the pda with the upper triangle zeroed out |
|
Return a copy of the pda with the lower triangle zeroed out |
|
Return the element-wise truncation of the array. |
|
Return a description for the given data type code. |
|
Count the occurrences of the unique values of an array. |
|
Compute the generalized dot product of two vectors along the given axis. |
|
Returns an array with elements chosen from A and B based upon a |
Module Contents¶
- class arkouda.numpy.ARKOUDA_SUPPORTED_DTYPES¶
frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object
Build an immutable unordered collection of unique elements.
- copy(*args, **kwargs)¶
Return a shallow copy of a set.
- difference(*args, **kwargs)¶
Return the difference of two or more sets as a new set.
(i.e. all elements that are in this set but not the others.)
- intersection(*args, **kwargs)¶
Return the intersection of two sets as a new set.
(i.e. all elements that are in both sets.)
- isdisjoint(*args, **kwargs)¶
Return True if two sets have a null intersection.
- issubset(*args, **kwargs)¶
Report whether another set contains this set.
- issuperset(*args, **kwargs)¶
Report whether this set contains another set.
- symmetric_difference(*args, **kwargs)¶
Return the symmetric difference of two sets as a new set.
(i.e. all elements that are in exactly one of the sets.)
- union(*args, **kwargs)¶
Return the union of sets as a new set.
(i.e. all elements that are in either set.)
- class arkouda.numpy.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.BoolDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.ByteDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.BytesDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.CLongDoubleDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.Complex128DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.Complex64DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.DType[source]¶
An enumeration.
- BIGINT(*args, **kwargs)¶
An enumeration.
- BOOL(*args, **kwargs)¶
An enumeration.
- COMPLEX128(*args, **kwargs)¶
An enumeration.
- COMPLEX64(*args, **kwargs)¶
An enumeration.
- FLOAT(*args, **kwargs)¶
An enumeration.
- FLOAT32(*args, **kwargs)¶
An enumeration.
- FLOAT64(*args, **kwargs)¶
An enumeration.
- INT(*args, **kwargs)¶
An enumeration.
- INT16(*args, **kwargs)¶
An enumeration.
- INT32(*args, **kwargs)¶
An enumeration.
- INT64(*args, **kwargs)¶
An enumeration.
- INT8(*args, **kwargs)¶
An enumeration.
- STR(*args, **kwargs)¶
An enumeration.
- UINT(*args, **kwargs)¶
An enumeration.
- UINT16(*args, **kwargs)¶
An enumeration.
- UINT32(*args, **kwargs)¶
An enumeration.
- UINT64(*args, **kwargs)¶
An enumeration.
- UINT8(*args, **kwargs)¶
An enumeration.
- name(*args, **kwargs)¶
The name of the Enum member.
- value(*args, **kwargs)¶
The value of the Enum member.
- class arkouda.numpy.DTypeObjects¶
frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object
Build an immutable unordered collection of unique elements.
- copy(*args, **kwargs)¶
Return a shallow copy of a set.
- difference(*args, **kwargs)¶
Return the difference of two or more sets as a new set.
(i.e. all elements that are in this set but not the others.)
- intersection(*args, **kwargs)¶
Return the intersection of two sets as a new set.
(i.e. all elements that are in both sets.)
- isdisjoint(*args, **kwargs)¶
Return True if two sets have a null intersection.
- issubset(*args, **kwargs)¶
Report whether another set contains this set.
- issuperset(*args, **kwargs)¶
Report whether this set contains another set.
- symmetric_difference(*args, **kwargs)¶
Return the symmetric difference of two sets as a new set.
(i.e. all elements that are in exactly one of the sets.)
- union(*args, **kwargs)¶
Return the union of sets as a new set.
(i.e. all elements that are in either set.)
- class arkouda.numpy.DTypes¶
frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object
Build an immutable unordered collection of unique elements.
- copy(*args, **kwargs)¶
Return a shallow copy of a set.
- difference(*args, **kwargs)¶
Return the difference of two or more sets as a new set.
(i.e. all elements that are in this set but not the others.)
- intersection(*args, **kwargs)¶
Return the intersection of two sets as a new set.
(i.e. all elements that are in both sets.)
- isdisjoint(*args, **kwargs)¶
Return True if two sets have a null intersection.
- issubset(*args, **kwargs)¶
Report whether another set contains this set.
- issuperset(*args, **kwargs)¶
Report whether this set contains another set.
- symmetric_difference(*args, **kwargs)¶
Return the symmetric difference of two sets as a new set.
(i.e. all elements that are in exactly one of the sets.)
- union(*args, **kwargs)¶
Return the union of sets as a new set.
(i.e. all elements that are in either set.)
- class arkouda.numpy.DataSource¶
DataSource(destpath=’.’)
A generic data source file (file, http, ftp, …).
DataSources can be local files or remote files/URLs. The files may also be compressed or uncompressed. DataSource hides some of the low-level details of downloading the file, allowing you to simply pass in a valid file path (or URL) and obtain a file object.
- Parameters:
destpath (str or None, optional) – Path to the directory where the source file gets downloaded to for use. If destpath is None, a temporary directory will be created. The default path is the current directory.
Notes
URLs require a scheme string (
http://
) to be used, without it they will fail:>>> repos = np.DataSource() >>> repos.exists('www.google.com/index.html') False >>> repos.exists('http://www.google.com/index.html') True
Temporary directories are deleted when the DataSource is deleted.
Examples
>>> ds = np.DataSource('/home/guido') >>> urlname = 'http://www.google.com/' >>> gfile = ds.open('http://www.google.com/') >>> ds.abspath(urlname) '/home/guido/www.google.com/index.html' >>> ds = np.DataSource(None) # use with temporary file >>> ds.open('/home/guido/foobar.txt') <open file '/home/guido.foobar.txt', mode 'r' at 0x91d4430> >>> ds.abspath('/home/guido/foobar.txt') '/tmp/.../home/guido/foobar.txt'
- abspath(path)[source]¶
Return absolute path of file in the DataSource directory.
If path is an URL, then abspath will return either the location the file exists locally or the location it would exist when opened using the open method.
- Parameters:
path (str) – Can be a local file or a remote URL.
- Returns:
out – Complete path, including the DataSource destination directory.
- Return type:
str
Notes
The functionality is based on os.path.abspath.
- exists(path)[source]¶
Test if path exists.
Test if path exists as (and in this order):
a local file.
a remote URL that has been downloaded and stored locally in the DataSource directory.
a remote URL that has not been downloaded, but is valid and accessible.
- Parameters:
path (str) – Can be a local file or a remote URL.
- Returns:
out – True if path exists.
- Return type:
bool
Notes
When path is an URL, exists will return True if it’s either stored locally in the DataSource directory, or is a valid remote URL. DataSource does not discriminate between the two, the file is accessible if it exists in either location.
- open(path, mode='r', encoding=None, newline=None)[source]¶
Open and return file-like object.
If path is an URL, it will be downloaded, stored in the DataSource directory and opened from there.
- Parameters:
path (str) – Local file path or URL to open.
mode ({'r', 'w', 'a'}, optional) – Mode to open path. Mode ‘r’ for reading, ‘w’ for writing, ‘a’ to append. Available modes depend on the type of object specified by path. Default is ‘r’.
encoding ({None, str}, optional) – Open text file with given encoding. The default encoding will be what io.open uses.
newline ({None, str}, optional) – Newline to use when reading text file.
- Returns:
out – File object.
- Return type:
file object
- class arkouda.numpy.DateTime64DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.ErrorMode[source]¶
An enumeration.
- ignore(*args, **kwargs)¶
An enumeration.
- name(*args, **kwargs)¶
The name of the Enum member.
- return_validity(*args, **kwargs)¶
An enumeration.
- strict(*args, **kwargs)¶
An enumeration.
- value(*args, **kwargs)¶
The value of the Enum member.
- class arkouda.numpy.False_(value)¶
Bases:
numpy.generic
Boolean type (True or False), stored as a byte.
- class arkouda.numpy.Float16DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.Float32DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.Float64DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- arkouda.numpy.Inf: float¶
- arkouda.numpy.Infinity: float¶
- class arkouda.numpy.Int16DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.Int32DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.Int64DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.Int8DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.IntDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.LongDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.LongDoubleDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.LongLongDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- arkouda.numpy.NAN: float¶
- arkouda.numpy.NINF: float¶
- class arkouda.numpy.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(*args, **kwargs)¶
D.clear() -> None. Remove all items from D.
- copy(*args, **kwargs)¶
D.copy() -> a shallow copy of D
- 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(*args, **kwargs)¶
D.items() -> a set-like object providing a view on D’s items
- keys(*args, **kwargs)¶
D.keys() -> a set-like object providing a view on D’s keys
- pop(*args, **kwargs)¶
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, default is returned if given, otherwise KeyError is raised
- 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 dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: 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(*args, **kwargs)¶
D.values() -> an object providing a view on D’s values
- arkouda.numpy.NZERO: float¶
- arkouda.numpy.NaN: float¶
- class arkouda.numpy.NumericDTypes¶
frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object
Build an immutable unordered collection of unique elements.
- copy(*args, **kwargs)¶
Return a shallow copy of a set.
- difference(*args, **kwargs)¶
Return the difference of two or more sets as a new set.
(i.e. all elements that are in this set but not the others.)
- intersection(*args, **kwargs)¶
Return the intersection of two sets as a new set.
(i.e. all elements that are in both sets.)
- isdisjoint(*args, **kwargs)¶
Return True if two sets have a null intersection.
- issubset(*args, **kwargs)¶
Report whether another set contains this set.
- issuperset(*args, **kwargs)¶
Report whether this set contains another set.
- symmetric_difference(*args, **kwargs)¶
Return the symmetric difference of two sets as a new set.
(i.e. all elements that are in exactly one of the sets.)
- union(*args, **kwargs)¶
Return the union of sets as a new set.
(i.e. all elements that are in either set.)
- class arkouda.numpy.ObjectDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- arkouda.numpy.PINF: float¶
- arkouda.numpy.PZERO: float¶
- class arkouda.numpy.RankWarning¶
Issued by polyfit when the Vandermonde matrix is rank deficient.
For more information, a way to suppress the warning, and an example of RankWarning being issued, see polyfit.
- class arkouda.numpy.ScalarDTypes¶
frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object
Build an immutable unordered collection of unique elements.
- copy(*args, **kwargs)¶
Return a shallow copy of a set.
- difference(*args, **kwargs)¶
Return the difference of two or more sets as a new set.
(i.e. all elements that are in this set but not the others.)
- intersection(*args, **kwargs)¶
Return the intersection of two sets as a new set.
(i.e. all elements that are in both sets.)
- isdisjoint(*args, **kwargs)¶
Return True if two sets have a null intersection.
- issubset(*args, **kwargs)¶
Report whether another set contains this set.
- issuperset(*args, **kwargs)¶
Report whether this set contains another set.
- symmetric_difference(*args, **kwargs)¶
Return the symmetric difference of two sets as a new set.
(i.e. all elements that are in exactly one of the sets.)
- union(*args, **kwargs)¶
Return the union of sets as a new set.
(i.e. all elements that are in either set.)
- class arkouda.numpy.ScalarType¶
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.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(*args, **kwargs)¶
D.clear() -> None. Remove all items from D.
- copy(*args, **kwargs)¶
D.copy() -> a shallow copy of D
- 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(*args, **kwargs)¶
D.items() -> a set-like object providing a view on D’s items
- keys(*args, **kwargs)¶
D.keys() -> a set-like object providing a view on D’s keys
- pop(*args, **kwargs)¶
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, default is returned if given, otherwise KeyError is raised
- 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 dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: 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(*args, **kwargs)¶
D.values() -> an object providing a view on D’s values
- class arkouda.numpy.ShortDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.StrDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.TimeDelta64DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.TooHardError[source]¶
max_work was exceeded.
This is raised whenever the maximum number of candidate solutions to consider specified by the
max_work
parameter is exceeded. Assigning a finite number to max_work may have caused the operation to fail.
- class arkouda.numpy.True_(value)¶
Bases:
numpy.generic
Boolean type (True or False), stored as a byte.
- class arkouda.numpy.UByteDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.UInt16DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.UInt32DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.UInt64DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.UInt8DType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.UIntDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.ULongDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.ULongLongDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.UShortDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- class arkouda.numpy.VoidDType(obj, align=False, copy=False)¶
Bases:
numpy.dtype
DType class corresponding to the scalar type and dtype of the same name.
Please see numpy.dtype for the typical way to create dtype instances and arrays.dtypes for additional information.
- arkouda.numpy.abs(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise absolute value of the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing absolute values of the input array elements
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Examples
>>> ak.abs(ak.arange(-5,-1)) array([5, 4, 3, 2])
>>> ak.abs(ak.linspace(-5,-1,5)) array([5, 4, 3, 2, 1])
- arkouda.numpy.add_newdoc(place, obj, doc, warn_on_python=True)[source]¶
Add documentation to an existing object, typically one defined in C
The purpose is to allow easier editing of the docstrings without requiring a re-compile. This exists primarily for internal use within numpy itself.
- Parameters:
place (str) – The absolute name of the module to import from
obj (str) – The name of the object to add documentation to, typically a class or function name
doc ({str, Tuple[str, str], List[Tuple[str, str]]}) –
If a string, the documentation to apply to obj
If a tuple, then the first element is interpreted as an attribute of obj and the second as the docstring to apply -
(method, docstring)
If a list, then each element of the list should be a tuple of length two -
[(method1, docstring1), (method2, docstring2), ...]
warn_on_python (bool) – If True, the default, emit UserWarning if this is used to attach documentation to a pure-python object.
Notes
This routine never raises an error if the docstring can’t be written, but will raise an error if the object being documented does not exist.
This routine cannot modify read-only docstrings, as appear in new-style classes or built-in functions. Because this routine never raises an error the caller must check manually that the docstrings were changed.
Since this function grabs the
char *
from a c-level str object and puts it into thetp_doc
slot of the type of obj, it violates a number of C-API best-practices, by:modifying a PyTypeObject after calling PyType_Ready
calling Py_INCREF on the str and losing the reference, so the str will never be released
If possible it should be avoided.
- class arkouda.numpy.all_scalars(origin, params, *, inst=True, name=None)¶
Bases:
_GenericAlias
The central part of 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.
- arkouda.numpy.arccos(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise inverse cosine of the array. The result is between 0 and pi.
- Parameters:
- Returns:
A pdarray containing inverse cosine for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.arccosh(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise inverse hyperbolic cosine of the array.
- Parameters:
- Returns:
A pdarray containing inverse hyperbolic cosine for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.arcsin(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise inverse sine of the array. The result is between -pi/2 and pi/2.
- Parameters:
- Returns:
A pdarray containing inverse sine for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.arcsinh(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise inverse hyperbolic sine of the array.
- Parameters:
- Returns:
A pdarray containing inverse hyperbolic sine for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.arctan(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise inverse tangent of the array. The result is between -pi/2 and pi/2.
- Parameters:
- Returns:
A pdarray containing inverse tangent for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.arctan2(num: arkouda.pdarrayclass.pdarray | float | numpy.float64 | numpy.float32 | int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64, denom: arkouda.pdarrayclass.pdarray | float | numpy.float64 | numpy.float32 | int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise inverse tangent of the array pair. The result chosen is the signed angle in radians between the ray ending at the origin and passing through the point (1,0), and the ray ending at the origin and passing through the point (denom, num). The result is between -pi and pi.
- Parameters:
num (Union[numeric_scalars, pdarray]) – Numerator of the arctan2 argument.
denom (Union[numeric_scalars, pdarray]) – Denominator of the arctan2 argument.
where (Boolean or pdarray) – This condition is broadcast over the input. At locations where the condition is True, the inverse tangent will be applied to the corresponding values. Elsewhere, it will retain its original value. Default set to True.
- Returns:
A pdarray containing inverse tangent for each corresponding element pair of the original pdarray, using the signed values or the numerator and denominator to get proper placement on unit circle.
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.arctanh(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise inverse hyperbolic tangent of the array.
- Parameters:
- Returns:
A pdarray containing inverse hyperbolic tangent for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameters are not a pdarray or numeric scalar.
- arkouda.numpy.array_equal(pda_a: arkouda.pdarrayclass.pdarray, pda_b: arkouda.pdarrayclass.pdarray, equal_nan: bool = False)[source]¶
Compares two pdarrays for equality. If neither array has any nan elements, then if all elements are pairwise equal, it returns True. If equal_Nan is False, then any nan element in either array gives a False return. If equal_Nan is True, then pairwise-corresponding nans are considered equal.
- Parameters:
- Returns:
- With string data:
False if one array is type ak.str_ & the other isn’t, True if both are ak.str_ & they match.
- With numeric data:
True if neither array has any nan elements, and all elements pairwise equal.
True if equal_Nan True, all non-nans pairwise equal & nans in pda_a correspond to nans in pda_b
False if equal_Nan False, & either array has any nan element.
- Return type:
boolean
Examples
>>> a = ak.randint(0,10,10,dtype=ak.float64) >>> b = a >>> ak.array_equal(a,b) True >>> b[9] = np.nan >>> ak.array_equal(a,b) False >>> a[9] = np.nan >>> ak.array_equal(a,b) False >>> ak.array_equal(a,b,True) True
- arkouda.numpy.base_repr(number, base=2, padding=0)¶
Return a string representation of a number in the given base system.
- Parameters:
number (int) – The value to convert. Positive and negative values are handled.
base (int, optional) – Convert number to the base number system. The valid range is 2-36, the default value is 2.
padding (int, optional) – Number of zeros padded on the left. Default is 0 (no padding).
- Returns:
out – String representation of number in base system.
- Return type:
str
See also
binary_repr
Faster version of base_repr for base 2.
Examples
>>> np.base_repr(5) '101' >>> np.base_repr(6, 5) '11' >>> np.base_repr(7, base=5, padding=3) '00012'
>>> np.base_repr(10, base=16) 'A' >>> np.base_repr(32, base=16) '20'
- class arkouda.numpy.bigint[source]¶
- 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
- 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 sys.getdefaultencoding(). 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.
- arkouda.numpy.binary_repr(num, width=None)¶
Return the binary representation of the input number as a string.
For negative numbers, if width is not given, a minus sign is added to the front. If width is given, the two’s complement of the number is returned, with respect to that width.
In a two’s-complement system negative numbers are represented by the two’s complement of the absolute value. This is the most common method of representing signed integers on computers [1]_. A N-bit two’s-complement system can represent every integer in the range \(-2^{N-1}\) to \(+2^{N-1}-1\).
- Parameters:
num (int) – Only an integer decimal number can be used.
width (int, optional) –
The length of the returned string if num is positive, or the length of the two’s complement if num is negative, provided that width is at least a sufficient number of bits for num to be represented in the designated form.
If the width value is insufficient, it will be ignored, and num will be returned in binary (num > 0) or two’s complement (num < 0) form with its width equal to the minimum number of bits needed to represent the number in the designated form. This behavior is deprecated and will later raise an error.
Deprecated since version 1.12.0.
- Returns:
bin – Binary representation of num or two’s complement of num.
- Return type:
str
See also
base_repr
Return a string representation of a number in the given base system.
bin
Python’s built-in binary representation generator of an integer.
Notes
binary_repr is equivalent to using base_repr with base 2, but about 25x faster.
References
Examples
>>> np.binary_repr(3) '11' >>> np.binary_repr(-3) '-11' >>> np.binary_repr(3, width=4) '0011'
The two’s complement is returned when the input number is negative and width is specified:
>>> np.binary_repr(-3, width=3) '101' >>> np.binary_repr(-3, width=5) '11101'
- class arkouda.numpy.bitType(value)¶
Bases:
numpy.unsignedinteger
Unsigned integer type, compatible with C
unsigned long
.- Character code:
'L'
- Canonical name:
numpy.uint
- Alias on this platform (Linux x86_64):
numpy.uint64: 64-bit unsigned integer (
0
to18_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(*args, **kwargs)¶
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
popcount
in C++.>>> np.uint64(127).bit_count() 7
- class arkouda.numpy.bool_(value)¶
Bases:
numpy.generic
Boolean type (True or False), stored as a byte.
- class arkouda.numpy.bool_scalars(origin, params, *, inst=True, name=None)¶
Bases:
_GenericAlias
The central part of 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.byte(value)¶
Bases:
numpy.signedinteger
Signed 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 (
-128
to127
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.int8(127).bit_count() 7 >>> np.int8(-127).bit_count() 7
- class arkouda.numpy.bytes_¶
A byte string.
When used in arrays, this type strips trailing null bytes.
- Character code:
'S'
- Alias:
numpy.string_
- T(*args, **kwargs)¶
Scalar attribute identical to the corresponding array attribute.
Please see ndarray.T.
- all(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.all.
- any(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.any.
- argmax(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.argmax.
- argmin(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.argmin.
- argsort(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.argsort.
- astype(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.astype.
- base(*args, **kwargs)¶
Scalar attribute identical to the corresponding array attribute.
Please see ndarray.base.
- byteswap(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.byteswap.
- choose(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.choose.
- clip(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.clip.
- compress(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.compress.
- conj(*args, **kwargs)¶
- conjugate(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.conjugate.
- copy(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.copy.
- cumprod(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.cumprod.
- cumsum(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.cumsum.
- data(*args, **kwargs)¶
Pointer to start of data.
- diagonal(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.diagonal.
- dtype(*args, **kwargs)¶
Get array data-descriptor.
- dump(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.dump.
- dumps(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.dumps.
- fill(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.fill.
- flags(*args, **kwargs)¶
The integer value of flags.
- flat(*args, **kwargs)¶
A 1-D view of the scalar.
- flatten(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.flatten.
- getfield(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.getfield.
- imag(*args, **kwargs)¶
The imaginary part of the scalar.
- item(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.item.
- itemset(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.itemset.
- itemsize(*args, **kwargs)¶
The length of one element in bytes.
- max(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.max.
- mean(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.mean.
- min(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.min.
- nbytes(*args, **kwargs)¶
The length of the scalar in bytes.
- ndim(*args, **kwargs)¶
The number of array dimensions.
- newbyteorder(*args, **kwargs)¶
newbyteorder(new_order=’S’, /)
Return a new dtype with a different byte order.
Changes are also made in all fields and sub-arrays of the data type.
The new_order code can be any from the following:
‘S’ - swap dtype from current to opposite endian
{‘<’, ‘little’} - little endian
{‘>’, ‘big’} - big endian
{‘=’, ‘native’} - native order
{‘|’, ‘I’} - ignore (no change to byte order)
- new_orderstr, optional
Byte order to force; a value from the byte order specifications above. The default value (‘S’) results in swapping the current byte order.
- new_dtypedtype
New dtype object with the given change to the byte order.
- nonzero(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.nonzero.
- prod(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.prod.
- ptp(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.ptp.
- put(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.put.
- ravel(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.ravel.
- real(*args, **kwargs)¶
The real part of the scalar.
- repeat(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.repeat.
- reshape(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.reshape.
- resize(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.resize.
- round(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.round.
- searchsorted(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.searchsorted.
- setfield(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.setfield.
- setflags(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.setflags.
- shape(*args, **kwargs)¶
Tuple of array dimensions.
- size(*args, **kwargs)¶
The number of elements in the gentype.
- sort(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.sort.
- squeeze(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.squeeze.
- std(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.std.
- strides(*args, **kwargs)¶
Tuple of bytes steps in each dimension.
- sum(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.sum.
- swapaxes(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.swapaxes.
- take(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.take.
- tobytes(*args, **kwargs)¶
- tofile(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.tofile.
- tolist(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.tolist.
- tostring(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.tostring.
- trace(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.trace.
- transpose(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.transpose.
- var(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.var.
- view(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.view.
- arkouda.numpy.cast(pda: arkouda.pdarrayclass.pdarray | arkouda.strings.Strings | Categorical, dt: numpy.dtype | type | str | dtypes.dtypes.bigint, errors: _numeric.ErrorMode = ErrorMode.strict) arkouda.pdarrayclass.pdarray | arkouda.strings.Strings | Categorical | Tuple[arkouda.pdarrayclass.pdarray, arkouda.pdarrayclass.pdarray] [source]¶
Cast an array to another dtype.
- Parameters:
dt (np.dtype, type, or str) – The target dtype to cast values to
errors ({strict, ignore, return_validity}) –
Controls how errors are handled when casting strings to a numeric type (ignored for casts from numeric types).
strict: raise RuntimeError if any string cannot be converted
- ignore: never raise an error. Uninterpretable strings get
converted to NaN (float64), -2**63 (int64), zero (uint64 and uint8), or False (bool)
return_validity: in addition to returning the same output as “ignore”, also return a bool array indicating where the cast was successful.
- Returns:
pdarray or Strings – Array of values cast to desired dtype
[validity (pdarray(bool)]) – If errors=”return_validity” and input is Strings, a second array is returned with True where the cast succeeded and False where it failed.
Notes
The cast is performed according to Chapel’s casting rules and is NOT safe from overflows or underflows. The user must ensure that the target dtype has the precision and capacity to hold the desired result.
Examples
>>> ak.cast(ak.linspace(1.0,5.0,5), dt=ak.int64) array([1, 2, 3, 4, 5])
>>> ak.cast(ak.arange(0,5), dt=ak.float64).dtype dtype('float64')
>>> ak.cast(ak.arange(0,5), dt=ak.bool_) array([False, True, True, True, True])
>>> ak.cast(ak.linspace(0,4,5), dt=ak.bool_) array([False, True, True, True, True])
- class arkouda.numpy.cdouble(value)¶
Bases:
numpy.complexfloating
- Complex number type composed of two double-precision floating-point
numbers, compatible with Python complex.
- Character code:
'D'
- Canonical name:
numpy.cdouble
- Alias:
numpy.cfloat
- Alias:
numpy.complex_
- Alias on this platform (Linux x86_64):
numpy.complex128: Complex number type composed of 2 64-bit-precision floating-point numbers.
- arkouda.numpy.ceil(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise ceiling of the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing ceiling values of the input array elements
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Examples
>>> ak.ceil(ak.linspace(1.1,5.5,5)) array([2, 3, 4, 5, 6])
- class arkouda.numpy.cfloat(value)¶
Bases:
numpy.complexfloating
- Complex number type composed of two double-precision floating-point
numbers, compatible with Python complex.
- Character code:
'D'
- Canonical name:
numpy.cdouble
- Alias:
numpy.cfloat
- Alias:
numpy.complex_
- Alias on this platform (Linux x86_64):
numpy.complex128: Complex number type composed of 2 64-bit-precision floating-point numbers.
- class arkouda.numpy.character(value)¶
Bases:
numpy.flexible
Abstract base class of all character string scalar types.
- arkouda.numpy.clip(pda: arkouda.pdarrayclass.pdarray, lo: float | numpy.float64 | numpy.float32 | int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 | arkouda.pdarrayclass.pdarray, hi: float | numpy.float64 | numpy.float32 | int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 | arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Clip (limit) the values in an array to a given range [lo,hi]
Given an array a, values outside the range are clipped to the range edges, such that all elements lie in the range.
There is no check to enforce that lo < hi. If lo > hi, the corresponding value of the array will be set to hi.
If lo or hi (or both) are pdarrays, the check is by pairwise elements. See examples.
- Parameters:
pda (pdarray, int64 or float64) – the array of values to clip
lo (scalar or pdarray, int64 or float64) – the lower value of the clipping range
hi (scalar or pdarray, int64 or float64) – the higher value of the clipping range
pdarrays (If lo or hi (or both) are) – See examples.
elements. (the check is by pairwise) – See examples.
- Returns:
- A pdarray matching pda, except that element x remains x if lo <= x <= hi,
or becomes lo if x < lo, or becomes hi if x > hi.
- Return type:
Examples
>>> a = ak.array([1,2,3,4,5,6,7,8,9,10]) >>> ak.clip(a,3,8) array([3,3,3,4,5,6,7,8,8,8]) >>> ak.clip(a,3,8.0) array([3.00000000000000000 3.00000000000000000 3.00000000000000000 4.00000000000000000 5.00000000000000000 6.00000000000000000 7.00000000000000000 8.00000000000000000 8.00000000000000000 8.00000000000000000]) >>> ak.clip(a,None,7) array([1,2,3,4,5,6,7,7,7,7]) >>> ak.clip(a,5,None) array([5,5,5,5,5,6,7,8,9,10]) >>> ak.clip(a,None,None) ValueError : either min or max must be supplied >>> ak.clip(a,ak.array([2,2,3,3,8,8,5,5,6,6],8)) array([2,2,3,4,8,8,7,8,8,8]) >>> ak.clip(a,4,ak.array([10,9,8,7,6,5,5,5,5,5])) array([4,4,4,4,5,5,5,5,5,5])
Notes
Either lo or hi may be None, but not both. If lo > hi, all x = hi. If all inputs are int64, output is int64, but if any input is float64, output is float64.
- Raises:
ValueError – Raised if both lo and hi are None
- class arkouda.numpy.clongdouble(value)¶
Bases:
numpy.complexfloating
- Complex number type composed of two extended-precision floating-point
numbers.
- Character code:
'G'
- Alias:
numpy.clongfloat
- Alias:
numpy.longcomplex
- Alias on this platform (Linux x86_64):
numpy.complex256: Complex number type composed of 2 128-bit extended-precision floating-point numbers.
- class arkouda.numpy.clongfloat(value)¶
Bases:
numpy.complexfloating
- Complex number type composed of two extended-precision floating-point
numbers.
- Character code:
'G'
- Alias:
numpy.clongfloat
- Alias:
numpy.longcomplex
- Alias on this platform (Linux x86_64):
numpy.complex256: Complex number type composed of 2 128-bit extended-precision floating-point numbers.
- class arkouda.numpy.complex128(value)¶
Bases:
numpy.complexfloating
- Complex number type composed of two double-precision floating-point
numbers, compatible with Python complex.
- Character code:
'D'
- Canonical name:
numpy.cdouble
- Alias:
numpy.cfloat
- Alias:
numpy.complex_
- Alias on this platform (Linux x86_64):
numpy.complex128: Complex number type composed of 2 64-bit-precision floating-point numbers.
- class arkouda.numpy.complex64(value)¶
Bases:
numpy.complexfloating
- Complex number type composed of two single-precision floating-point
numbers.
- Character code:
'F'
- Canonical name:
numpy.csingle
- Alias:
numpy.singlecomplex
- Alias on this platform (Linux x86_64):
numpy.complex64: Complex number type composed of 2 32-bit-precision floating-point numbers.
- arkouda.numpy.cos(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise cosine of the array.
- Parameters:
- Returns:
A pdarray containing cosine for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.cosh(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise hyperbolic cosine of the array.
- Parameters:
- Returns:
A pdarray containing hyperbolic cosine for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.count_nonzero(pda)[source]¶
Compute the nonzero count of a given array. 1D case only, for now.
- Parameters:
pda (pdarray) – The input data, in pdarray form, numeric, bool, or str
- Returns:
The nonzero count of the entire pdarray
- Return type:
np.int64
Examples
>>> pda = ak.array([0,4,7,8,1,3,5,2,-1]) >>> ak.count_nonzero(pda) 9 >>> pda = ak.array([False,True,False,True,False]) >>> ak.count_nonzero(pda) 3 >>> pda = ak.array(["hello","","there"]) >>> ak.count_nonzero(pda) 2
- class arkouda.numpy.csingle(value)¶
Bases:
numpy.complexfloating
- Complex number type composed of two single-precision floating-point
numbers.
- Character code:
'F'
- Canonical name:
numpy.csingle
- Alias:
numpy.singlecomplex
- Alias on this platform (Linux x86_64):
numpy.complex64: Complex number type composed of 2 32-bit-precision floating-point numbers.
- arkouda.numpy.cumprod(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the cumulative product over the array.
The product is inclusive, such that the
i
th element of the result is the product of elements up to and includingi
.- Parameters:
pda (pdarray)
- Returns:
A pdarray containing cumulative products for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Examples
>>> ak.cumprod(ak.arange(1,5)) array([1, 2, 6, 24]))
>>> ak.cumprod(ak.uniform(5,1.0,5.0)) array([1.5728783400481925, 7.0472855509390593, 33.78523998586553, 134.05309592737584, 450.21589865655358])
- arkouda.numpy.cumsum(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the cumulative sum over the array.
The sum is inclusive, such that the
i
th element of the result is the sum of elements up to and includingi
.- Parameters:
pda (pdarray)
- Returns:
A pdarray containing cumulative sums for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Examples
>>> ak.cumsum(ak.arange([1,5])) array([1, 3, 6])
>>> ak.cumsum(ak.uniform(5,1.0,5.0)) array([3.1598310770203937, 5.4110385860243131, 9.1622479306453748, 12.710615785506533, 13.945880905466208])
>>> ak.cumsum(ak.randint(0, 1, 5, dtype=ak.bool_)) array([0, 1, 1, 2, 3])
- class arkouda.numpy.datetime64(value)¶
Bases:
numpy.generic
- If created from a 64-bit integer, it represents an offset from
1970-01-01T00:00:00
. If created from string, the string can be in ISO 8601 date or datetime format.>>> np.datetime64(10, 'Y') numpy.datetime64('1980') >>> np.datetime64('1980', 'Y') numpy.datetime64('1980') >>> np.datetime64(10, 'D') numpy.datetime64('1970-01-11')
See arrays.datetime for more information.
- Character code:
'M'
- arkouda.numpy.deg2rad(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Converts angles element-wise from degrees to radians.
- Parameters:
- Returns:
A pdarray containing an angle converted to radians, from degrees, for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.deprecate(*args, **kwargs)[source]¶
Issues a DeprecationWarning, adds warning to old_name’s docstring, rebinds
old_name.__name__
and returns the new function object.This function may also be used as a decorator.
- Parameters:
func (function) – The function to be deprecated.
old_name (str, optional) – The name of the function to be deprecated. Default is None, in which case the name of func is used.
new_name (str, optional) – The new name for the function. Default is None, in which case the deprecation message is that old_name is deprecated. If given, the deprecation message is that old_name is deprecated and new_name should be used instead.
message (str, optional) – Additional explanation of the deprecation. Displayed in the docstring after the warning.
- Returns:
old_func – The deprecated function.
- Return type:
function
Examples
Note that
olduint
returns a value after printing Deprecation Warning:>>> olduint = np.deprecate(np.uint) DeprecationWarning: `uint64` is deprecated! # may vary >>> olduint(6) 6
- arkouda.numpy.deprecate_with_doc(msg)[source]¶
Deprecates a function and includes the deprecation in its docstring.
This function is used as a decorator. It returns an object that can be used to issue a DeprecationWarning, by passing the to-be decorated function as argument, this adds warning to the to-be decorated function’s docstring and returns the new function object.
See also
deprecate
Decorate a function such that it issues a DeprecationWarning
- Parameters:
msg (str) – Additional explanation of the deprecation. Displayed in the docstring after the warning.
- Returns:
obj
- Return type:
object
- arkouda.numpy.disp(mesg, device=None, linefeed=True)[source]¶
Display a message on a device.
- Parameters:
mesg (str) – Message to display.
device (object) – Device to write message. If None, defaults to
sys.stdout
which is very similar toprint
. device needs to havewrite()
andflush()
methods.linefeed (bool, optional) – Option whether to print a line feed or not. Defaults to True.
- Raises:
AttributeError – If device does not have a
write()
orflush()
method.
Examples
Besides
sys.stdout
, a file-like object can also be used as it has both required methods:>>> from io import StringIO >>> buf = StringIO() >>> np.disp(u'"Display" in a file', device=buf) >>> buf.getvalue() '"Display" in a file\n'
- class arkouda.numpy.double(value)¶
Bases:
numpy.floating
- Double-precision floating-point number type, compatible with Python float
and C
double
.- Character code:
'd'
- Canonical name:
numpy.double
- Alias:
numpy.float_
- 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(*args, **kwargs)¶
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(*args, **kwargs)¶
double.is_integer() -> bool
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
>>> np.double(-2.0).is_integer() True >>> np.double(3.2).is_integer() False
- arkouda.numpy.e: float¶
- arkouda.numpy.euler_gamma: float¶
- arkouda.numpy.exp(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise exponential of the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing exponential values of the input array elements
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Examples
>>> ak.exp(ak.arange(1,5)) array([2.7182818284590451, 7.3890560989306504, 20.085536923187668, 54.598150033144236])
>>> ak.exp(ak.uniform(5,1.0,5.0)) array([11.84010843172504, 46.454368507659211, 5.5571769623557188, 33.494295836924771, 13.478894913238722])
- arkouda.numpy.expm1(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise exponential of the array minus one.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing exponential values of the input array elements minus one
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Examples
>>> ak.exp1m(ak.arange(1,5)) array([1.7182818284590451, 6.3890560989306504, 19.085536923187668, 53.598150033144236])
>>> ak.exp1m(ak.uniform(5,1.0,5.0)) array([10.84010843172504, 45.454368507659211, 4.5571769623557188, 32.494295836924771, 12.478894913238722])
- arkouda.numpy.eye(rows: int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64, cols: int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64, diag: int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 = 0, dt: type = numpy.int64)[source]¶
Return a pdarray with zeros everywhere except along a diagonal, which is all ones. The matrix need not be square.
- Parameters:
rows (int_scalars)
cols (int_scalars)
diag (int_scalars) – if diag = 0, zeros start at element [0,0] and proceed along diagonal if diag > 0, zeros start at element [0,diag] and proceed along diagonal if diag < 0, zeros start at element [diag,0] and proceed along diagonal etc.
- Returns:
an array of zeros with ones along the specified diagonal
- Return type:
Examples
>>> ak.eye(rows=4,cols=4,diag=0,dt=ak.int64) array([array([1 0 0 0]) array([0 1 0 0]) array([0 0 1 0]) array([0 0 0 1])]) >>> ak.eye(rows=3,cols=3,diag=1,dt=ak.float64) array([array([0.00000000000000000 1.00000000000000000 0.00000000000000000]) array([0.00000000000000000 0.00000000000000000 1.00000000000000000]) array([0.00000000000000000 0.00000000000000000 0.00000000000000000])]) >>> ak.eye(rows=4,cols=4,diag=-1,dt=ak.bool_) array([array([False False False False]) array([True False False False]) array([False True False False]) array([False False True False])]
Notes
if rows = cols and diag = 0, the result is an identity matrix Server returns an error if rank of pda < 2
- class arkouda.numpy.finfo¶
finfo(dtype)
Machine limits for floating point types.
- bits¶
The number of bits occupied by the type.
- Type:
int
- dtype¶
Returns the dtype for which finfo returns information. For complex input, the returned dtype is the associated
float*
dtype for its real and complex components.- Type:
dtype
- eps¶
The difference between 1.0 and the next smallest representable float larger than 1.0. For example, for 64-bit binary floats in the IEEE-754 standard,
eps = 2**-52
, approximately 2.22e-16.- Type:
float
- epsneg¶
The difference between 1.0 and the next smallest representable float less than 1.0. For example, for 64-bit binary floats in the IEEE-754 standard,
epsneg = 2**-53
, approximately 1.11e-16.- Type:
float
- iexp¶
The number of bits in the exponent portion of the floating point representation.
- Type:
int
- machep¶
The exponent that yields eps.
- Type:
int
- max¶
The largest representable number.
- Type:
floating point number of the appropriate type
- maxexp¶
The smallest positive power of the base (2) that causes overflow.
- Type:
int
- min¶
The smallest representable number, typically
-max
.- Type:
floating point number of the appropriate type
- minexp¶
The most negative power of the base (2) consistent with there being no leading 0’s in the mantissa.
- Type:
int
- negep¶
The exponent that yields epsneg.
- Type:
int
- nexp¶
The number of bits in the exponent including its sign and bias.
- Type:
int
- nmant¶
The number of bits in the mantissa.
- Type:
int
- precision¶
The approximate number of decimal digits to which this kind of float is precise.
- Type:
int
- resolution¶
The approximate decimal resolution of this type, i.e.,
10**-precision
.- Type:
floating point number of the appropriate type
- tiny¶
An alias for smallest_normal, kept for backwards compatibility.
- Type:
float
- smallest_normal¶
The smallest positive floating point number with 1 as leading bit in the mantissa following IEEE-754 (see Notes).
- Type:
float
- smallest_subnormal¶
The smallest positive floating point number with 0 as leading bit in the mantissa following IEEE-754.
- Type:
float
- Parameters:
dtype (float, dtype, or instance) – Kind of floating point or complex floating point data-type about which to get information.
See also
iinfo
The equivalent for integer data types.
spacing
The distance between a value and the nearest adjacent number
nextafter
The next floating point value after x1 towards x2
Notes
For developers of NumPy: do not instantiate this at the module level. The initial calculation of these parameters is expensive and negatively impacts import times. These objects are cached, so calling
finfo()
repeatedly inside your functions is not a problem.Note that
smallest_normal
is not actually the smallest positive representable value in a NumPy floating point type. As in the IEEE-754 standard [1]_, NumPy floating point types make use of subnormal numbers to fill the gap between 0 andsmallest_normal
. However, subnormal numbers may have significantly reduced precision [2].This function can also be used for complex data types as well. If used, the output will be the same as the corresponding real float type (e.g. numpy.finfo(numpy.csingle) is the same as numpy.finfo(numpy.single)). However, the output is true for the real and imaginary components.
References
[1] IEEE Standard for Floating-Point Arithmetic, IEEE Std 754-2008, pp.1-70, 2008, http://www.doi.org/10.1109/IEEESTD.2008.4610935
[2] Wikipedia, “Denormal Numbers”, https://en.wikipedia.org/wiki/Denormal_number
Examples
>>> np.finfo(np.float64).dtype dtype('float64') >>> np.finfo(np.complex64).dtype dtype('float32')
- property smallest_normal¶
Return the value for the smallest normal.
- Returns:
smallest_normal – Value for the smallest normal.
- Return type:
float
- Warns:
UserWarning – If the calculated value for the smallest normal is requested for double-double.
- property tiny¶
Return the value for tiny, alias of smallest_normal.
- Returns:
tiny – Value for the smallest normal, alias of smallest_normal.
- Return type:
float
- Warns:
UserWarning – If the calculated value for the smallest normal is requested for double-double.
- class arkouda.numpy.flexible(value)¶
Bases:
numpy.generic
- Abstract base class of all scalar types without predefined length.
The actual size of these types depends on the specific np.dtype instantiation.
- arkouda.numpy.flip(x: arkouda.pdarrayclass.pdarray | arkouda.strings.Strings | arkouda.categorical.Categorical, /, *, axis: int | Tuple[int, Ellipsis] | NoneType = None) arkouda.pdarrayclass.pdarray | arkouda.strings.Strings | arkouda.categorical.Categorical [source]¶
Reverse an array’s values along a particular axis or axes.
- Parameters:
x (pdarray, Strings, or Categorical) –
Reverse the order of elements in an array along the given axis.
The shape of the array is preserved, but the elements are reordered.
axis (int or Tuple[int, ...], optional) – The axis or axes along which to flip the array. If None, flip the array along all axes.
- Returns:
An array with the entries of axis reversed.
- Return type:
pdarray, Strings, or Categorical
Note
This differs from numpy as it actually reverses the data, rather than presenting a view.
- class arkouda.numpy.float16(value)¶
Bases:
numpy.floating
Half-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(*args, **kwargs)¶
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(*args, **kwargs)¶
half.is_integer() -> bool
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
>>> np.half(-2.0).is_integer() True >>> np.half(3.2).is_integer() False
- class arkouda.numpy.float32(value)¶
Bases:
numpy.floating
Single-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(*args, **kwargs)¶
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(*args, **kwargs)¶
single.is_integer() -> bool
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
>>> np.single(-2.0).is_integer() True >>> np.single(3.2).is_integer() False
- class arkouda.numpy.float64(value)¶
Bases:
numpy.floating
- Double-precision floating-point number type, compatible with Python float
and C
double
.- Character code:
'd'
- Canonical name:
numpy.double
- Alias:
numpy.float_
- 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(*args, **kwargs)¶
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(*args, **kwargs)¶
double.is_integer() -> bool
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
>>> np.double(-2.0).is_integer() True >>> np.double(3.2).is_integer() False
- class arkouda.numpy.float_(value)¶
Bases:
numpy.floating
- Double-precision floating-point number type, compatible with Python float
and C
double
.- Character code:
'd'
- Canonical name:
numpy.double
- Alias:
numpy.float_
- 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(*args, **kwargs)¶
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(*args, **kwargs)¶
double.is_integer() -> bool
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
>>> np.double(-2.0).is_integer() True >>> np.double(3.2).is_integer() False
- class arkouda.numpy.float_scalars(origin, params, *, inst=True, name=None)¶
Bases:
_GenericAlias
The central part of 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.floating(value)¶
Bases:
numpy.inexact
Abstract base class of all floating-point scalar types.
- arkouda.numpy.floor(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise floor of the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing floor values of the input array elements
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Examples
>>> ak.floor(ak.linspace(1.1,5.5,5)) array([1, 2, 3, 4, 5])
- arkouda.numpy.format_float_positional(x, precision=None, unique=True, fractional=True, trim='k', sign=False, pad_left=None, pad_right=None, min_digits=None)¶
Format a floating-point scalar as a decimal string in positional notation.
Provides control over rounding, trimming and padding. Uses and assumes IEEE unbiased rounding. Uses the “Dragon4” algorithm.
- Parameters:
x (python float or numpy floating scalar) – Value to format.
precision (non-negative integer or None, optional) – Maximum number of digits to print. May be None if unique is True, but must be an integer if unique is False.
unique (boolean, optional) – If True, use a digit-generation strategy which gives the shortest representation which uniquely identifies the floating-point number from other values of the same type, by judicious rounding. If precision is given fewer digits than necessary can be printed, or if min_digits is given more can be printed, in which cases the last digit is rounded with unbiased rounding. If False, digits are generated as if printing an infinite-precision value and stopping after precision digits, rounding the remaining value with unbiased rounding
fractional (boolean, optional) – If True, the cutoffs of precision and min_digits refer to the total number of digits after the decimal point, including leading zeros. If False, precision and min_digits refer to the total number of significant digits, before or after the decimal point, ignoring leading zeros.
trim (one of 'k', '.', '0', '-', optional) –
Controls post-processing trimming of trailing digits, as follows:
’k’ : keep trailing zeros, keep decimal point (no trimming)
’.’ : trim all trailing zeros, leave decimal point
’0’ : trim all but the zero before the decimal point. Insert the zero if it is missing.
’-’ : trim trailing zeros and any trailing decimal point
sign (boolean, optional) – Whether to show the sign for positive values.
pad_left (non-negative integer, optional) – Pad the left side of the string with whitespace until at least that many characters are to the left of the decimal point.
pad_right (non-negative integer, optional) – Pad the right side of the string with whitespace until at least that many characters are to the right of the decimal point.
min_digits (non-negative integer or None, optional) –
Minimum number of digits to print. Only has an effect if unique=True in which case additional digits past those necessary to uniquely identify the value may be printed, rounding the last additional digit.
– versionadded:: 1.21.0
- Returns:
rep – The string representation of the floating point value
- Return type:
string
See also
Examples
>>> np.format_float_positional(np.float32(np.pi)) '3.1415927' >>> np.format_float_positional(np.float16(np.pi)) '3.14' >>> np.format_float_positional(np.float16(0.3)) '0.3' >>> np.format_float_positional(np.float16(0.3), unique=False, precision=10) '0.3000488281'
- arkouda.numpy.format_float_scientific(x, precision=None, unique=True, trim='k', sign=False, pad_left=None, exp_digits=None, min_digits=None)¶
Format a floating-point scalar as a decimal string in scientific notation.
Provides control over rounding, trimming and padding. Uses and assumes IEEE unbiased rounding. Uses the “Dragon4” algorithm.
- Parameters:
x (python float or numpy floating scalar) – Value to format.
precision (non-negative integer or None, optional) – Maximum number of digits to print. May be None if unique is True, but must be an integer if unique is False.
unique (boolean, optional) – If True, use a digit-generation strategy which gives the shortest representation which uniquely identifies the floating-point number from other values of the same type, by judicious rounding. If precision is given fewer digits than necessary can be printed. If min_digits is given more can be printed, in which cases the last digit is rounded with unbiased rounding. If False, digits are generated as if printing an infinite-precision value and stopping after precision digits, rounding the remaining value with unbiased rounding
trim (one of 'k', '.', '0', '-', optional) –
Controls post-processing trimming of trailing digits, as follows:
’k’ : keep trailing zeros, keep decimal point (no trimming)
’.’ : trim all trailing zeros, leave decimal point
’0’ : trim all but the zero before the decimal point. Insert the zero if it is missing.
’-’ : trim trailing zeros and any trailing decimal point
sign (boolean, optional) – Whether to show the sign for positive values.
pad_left (non-negative integer, optional) – Pad the left side of the string with whitespace until at least that many characters are to the left of the decimal point.
exp_digits (non-negative integer, optional) – Pad the exponent with zeros until it contains at least this many digits. If omitted, the exponent will be at least 2 digits.
min_digits (non-negative integer or None, optional) –
Minimum number of digits to print. This only has an effect for unique=True. In that case more digits than necessary to uniquely identify the value may be printed and rounded unbiased.
– versionadded:: 1.21.0
- Returns:
rep – The string representation of the floating point value
- Return type:
string
See also
Examples
>>> np.format_float_scientific(np.float32(np.pi)) '3.1415927e+00' >>> s = np.float32(1.23e24) >>> np.format_float_scientific(s, unique=False, precision=15) '1.230000071797338e+24' >>> np.format_float_scientific(s, exp_digits=4) '1.23e+0024'
- class arkouda.numpy.format_parser¶
Class to convert formats, names, titles description to a dtype.
After constructing the format_parser object, the dtype attribute is the converted data-type:
dtype = format_parser(formats, names, titles).dtype
- dtype¶
The converted data-type.
- Type:
dtype
- Parameters:
formats (str or list of str) – The format description, either specified as a string with comma-separated format descriptions in the form
'f8, i4, a5'
, or a list of format description strings in the form['f8', 'i4', 'a5']
.names (str or list/tuple of str) – The field names, either specified as a comma-separated string in the form
'col1, col2, col3'
, or as a list or tuple of strings in the form['col1', 'col2', 'col3']
. An empty list can be used, in that case default field names (‘f0’, ‘f1’, …) are used.titles (sequence) – Sequence of title strings. An empty list can be used to leave titles out.
aligned (bool, optional) – If True, align the fields by padding as the C-compiler would. Default is False.
byteorder (str, optional) – If specified, all the fields will be changed to the provided byte-order. Otherwise, the default byte-order is used. For all available string specifiers, see dtype.newbyteorder.
Examples
>>> np.format_parser(['<f8', '<i4', '<a5'], ['col1', 'col2', 'col3'], ... ['T1', 'T2', 'T3']).dtype dtype([(('T1', 'col1'), '<f8'), (('T2', 'col2'), '<i4'), (('T3', 'col3'), 'S5')])
names and/or titles can be empty lists. If titles is an empty list, titles will simply not appear. If names is empty, default field names will be used.
>>> np.format_parser(['f8', 'i4', 'a5'], ['col1', 'col2', 'col3'], ... []).dtype dtype([('col1', '<f8'), ('col2', '<i4'), ('col3', '<S5')]) >>> np.format_parser(['<f8', '<i4', '<a5'], [], []).dtype dtype([('f0', '<f8'), ('f1', '<i4'), ('f2', 'S5')])
- arkouda.numpy.get_byteorder(dt: np.dtype) str [source]¶
Get a concrete byteorder (turns ‘=’ into ‘<’ or ‘>’)
- class arkouda.numpy.half(value)¶
Bases:
numpy.floating
Half-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(*args, **kwargs)¶
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(*args, **kwargs)¶
half.is_integer() -> bool
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
>>> np.half(-2.0).is_integer() True >>> np.half(3.2).is_integer() False
- arkouda.numpy.hash(pda: arkouda.pdarrayclass.pdarray | arkouda.strings.Strings | SegArray | Categorical | List[arkouda.pdarrayclass.pdarray | arkouda.strings.Strings | SegArray | Categorical], full: bool = True) Tuple[arkouda.pdarrayclass.pdarray, arkouda.pdarrayclass.pdarray] | arkouda.pdarrayclass.pdarray [source]¶
Return an element-wise hash of the array or list of arrays.
- Parameters:
pda (Union[pdarray, Strings, Segarray, Categorical],) – List[Union[pdarray, Strings, Segarray, Categorical]]]
full (bool) – This is only used when a single pdarray is passed into hash By default, a 128-bit hash is computed and returned as two int64 arrays. If full=False, then a 64-bit hash is computed and returned as a single int64 array.
- Returns:
If full=True or a list of pdarrays is passed, a 2-tuple of pdarrays containing the high and low 64 bits of each hash, respectively. If full=False and a single pdarray is passed, a single pdarray containing a 64-bit hash
- Return type:
hashes
- Raises:
TypeError – Raised if the parameter is not a pdarray
Notes
In the case of a single pdarray being passed, this function uses the SIPhash algorithm, which can output either a 64-bit or 128-bit hash. However, the 64-bit hash runs a significant risk of collisions when applied to more than a few million unique values. Unless the number of unique values is known to be small, the 128-bit hash is strongly recommended.
Note that this hash should not be used for security, or for any cryptographic application. Not only is SIPhash not intended for such uses, but this implementation employs a fixed key for the hash, which makes it possible for an adversary with control over input to engineer collisions.
In the case of a list of pdrrays, Strings, Categoricals, or Segarrays being passed, a non-linear function must be applied to each array since hashes of subsequent arrays cannot be simply XORed because equivalent values will cancel each other out, hence we do a rotation by the ordinal of the array.
- arkouda.numpy.histogram(pda: arkouda.pdarrayclass.pdarray, bins: int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 = 10) Tuple[arkouda.pdarrayclass.pdarray, arkouda.pdarrayclass.pdarray] [source]¶
Compute a histogram of evenly spaced bins over the range of an array.
- Parameters:
pda (pdarray) – The values to histogram
bins (int_scalars) – The number of equal-size bins to use (default: 10)
- Returns:
Bin edges and The number of values present in each bin
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray or if bins is not an int.
ValueError – Raised if bins < 1
NotImplementedError – Raised if pdarray dtype is bool or uint8
See also
Notes
The bins are evenly spaced in the interval [pda.min(), pda.max()].
Examples
>>> import matplotlib.pyplot as plt >>> A = ak.arange(0, 10, 1) >>> nbins = 3 >>> h, b = ak.histogram(A, bins=nbins) >>> h array([3, 3, 4]) >>> b array([0., 3., 6., 9.])
# To plot, export the left edges and the histogram to NumPy >>> plt.plot(b.to_ndarray()[::-1], h.to_ndarray())
- arkouda.numpy.histogram2d(x: arkouda.pdarrayclass.pdarray, y: arkouda.pdarrayclass.pdarray, bins: int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 | Sequence[int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64] = 10) Tuple[arkouda.pdarrayclass.pdarray, arkouda.pdarrayclass.pdarray, arkouda.pdarrayclass.pdarray] [source]¶
Compute the bi-dimensional histogram of two data samples with evenly spaced bins
- Parameters:
x (pdarray) – A pdarray containing the x coordinates of the points to be histogrammed.
y (pdarray) – A pdarray containing the y coordinates of the points to be histogrammed.
bins (int_scalars or [int, int] = 10) – The number of equal-size bins to use. If int, the number of bins for the two dimensions (nx=ny=bins). If [int, int], the number of bins in each dimension (nx, ny = bins). Defaults to 10
- Returns:
hist (pdarray) – shape(nx, ny) The bi-dimensional histogram of samples x and y. Values in x are histogrammed along the first dimension and values in y are histogrammed along the second dimension.
x_edges (pdarray) – The bin edges along the first dimension.
y_edges (pdarray) – The bin edges along the second dimension.
- Raises:
TypeError – Raised if x or y parameters are not pdarrays or if bins is not an int or (int, int).
ValueError – Raised if bins < 1
NotImplementedError – Raised if pdarray dtype is bool or uint8
See also
Notes
The x bins are evenly spaced in the interval [x.min(), x.max()] and y bins are evenly spaced in the interval [y.min(), y.max()].
Examples
>>> x = ak.arange(0, 10, 1) >>> y = ak.arange(9, -1, -1) >>> nbins = 3 >>> h, x_edges, y_edges = ak.histogram2d(x, y, bins=nbins) >>> h array([[0, 0, 3], [0, 2, 1], [3, 1, 0]]) >>> x_edges array([0.0 3.0 6.0 9.0]) >>> x_edges array([0.0 3.0 6.0 9.0])
- arkouda.numpy.histogramdd(sample: Sequence[arkouda.pdarrayclass.pdarray], bins: int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 | Sequence[int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64] = 10) Tuple[arkouda.pdarrayclass.pdarray, Sequence[arkouda.pdarrayclass.pdarray]] [source]¶
Compute the multidimensional histogram of data in sample with evenly spaced bins.
- Parameters:
sample (Sequence[pdarray]) – A sequence of pdarrays containing the coordinates of the points to be histogrammed.
bins (int_scalars or Sequence[int_scalars] = 10) – The number of equal-size bins to use. If int, the number of bins for all dimensions (nx=ny=…=bins). If [int, int, …], the number of bins in each dimension (nx, ny, … = bins). Defaults to 10
- Returns:
hist (pdarray) – shape(nx, ny, …, nd) The multidimensional histogram of pdarrays in sample. Values in first pdarray are histogrammed along the first dimension. Values in second pdarray are histogrammed along the second dimension and so on.
edges (List[pdarray]) – A list of pdarrays containing the bin edges for each dimension.
- Raises:
ValueError – Raised if bins < 1
NotImplementedError – Raised if pdarray dtype is bool or uint8
See also
Notes
The bins for each dimension, m, are evenly spaced in the interval [m.min(), m.max()]
Examples
>>> x = ak.arange(0, 10, 1) >>> y = ak.arange(9, -1, -1) >>> z = ak.where(x % 2 == 0, x, y) >>> h, edges = ak.histogramdd((x, y,z), bins=(2,2,5)) >>> h array([[[0, 0, 0, 0, 0], [1, 1, 1, 1, 1]],
- [[1, 1, 1, 1, 1],
[0, 0, 0, 0, 0]]])
>>> edges [array([0.0 4.5 9.0]), array([0.0 4.5 9.0]), array([0.0 1.6 3.2 4.8 6.4 8.0])]
- class arkouda.numpy.iinfo¶
iinfo(type)
Machine limits for integer types.
- bits¶
The number of bits occupied by the type.
- Type:
int
- dtype¶
Returns the dtype for which iinfo returns information.
- Type:
dtype
- min¶
The smallest integer expressible by the type.
- Type:
int
- max¶
The largest integer expressible by the type.
- Type:
int
- Parameters:
int_type (integer type, dtype, or instance) – The kind of integer data type to get information about.
See also
finfo
The equivalent for floating point data types.
Examples
With types:
>>> ii16 = np.iinfo(np.int16) >>> ii16.min -32768 >>> ii16.max 32767 >>> ii32 = np.iinfo(np.int32) >>> ii32.min -2147483648 >>> ii32.max 2147483647
With instances:
>>> ii32 = np.iinfo(np.int32(10)) >>> ii32.min -2147483648 >>> ii32.max 2147483647
- property max¶
Maximum value of given dtype.
- property min¶
Minimum value of given dtype.
- class arkouda.numpy.inexact(value)¶
Bases:
numpy.number
- Abstract base class of all numeric scalar types with a (potentially)
inexact representation of the values in its range, such as floating-point numbers.
- arkouda.numpy.inf: float¶
- arkouda.numpy.infty: float¶
- class arkouda.numpy.int16(value)¶
Bases:
numpy.signedinteger
Signed 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_768
to32_767
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.int16(127).bit_count() 7 >>> np.int16(-127).bit_count() 7
- class arkouda.numpy.int32(value)¶
Bases:
numpy.signedinteger
Signed 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_648
to2_147_483_647
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.int32(127).bit_count() 7 >>> np.int32(-127).bit_count() 7
- class arkouda.numpy.int64(value)¶
Bases:
numpy.signedinteger
Signed integer type, compatible with Python int and C
long
.- Character code:
'l'
- Canonical name:
numpy.int_
- Alias on this platform (Linux x86_64):
numpy.int64: 64-bit signed integer (
-9_223_372_036_854_775_808
to9_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(*args, **kwargs)¶
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
popcount
in C++.>>> np.int64(127).bit_count() 7 >>> np.int64(-127).bit_count() 7
- class arkouda.numpy.int8(value)¶
Bases:
numpy.signedinteger
Signed 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 (
-128
to127
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.int8(127).bit_count() 7 >>> np.int8(-127).bit_count() 7
- class arkouda.numpy.intTypes¶
frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object
Build an immutable unordered collection of unique elements.
- copy(*args, **kwargs)¶
Return a shallow copy of a set.
- difference(*args, **kwargs)¶
Return the difference of two or more sets as a new set.
(i.e. all elements that are in this set but not the others.)
- intersection(*args, **kwargs)¶
Return the intersection of two sets as a new set.
(i.e. all elements that are in both sets.)
- isdisjoint(*args, **kwargs)¶
Return True if two sets have a null intersection.
- issubset(*args, **kwargs)¶
Report whether another set contains this set.
- issuperset(*args, **kwargs)¶
Report whether this set contains another set.
- symmetric_difference(*args, **kwargs)¶
Return the symmetric difference of two sets as a new set.
(i.e. all elements that are in exactly one of the sets.)
- union(*args, **kwargs)¶
Return the union of sets as a new set.
(i.e. all elements that are in either set.)
- class arkouda.numpy.int_(value)¶
Bases:
numpy.signedinteger
Signed integer type, compatible with Python int and C
long
.- Character code:
'l'
- Canonical name:
numpy.int_
- Alias on this platform (Linux x86_64):
numpy.int64: 64-bit signed integer (
-9_223_372_036_854_775_808
to9_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(*args, **kwargs)¶
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
popcount
in C++.>>> np.int64(127).bit_count() 7 >>> np.int64(-127).bit_count() 7
- class arkouda.numpy.int_scalars(origin, params, *, inst=True, name=None)¶
Bases:
_GenericAlias
The central part of 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.intc(value)¶
Bases:
numpy.signedinteger
Signed 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_648
to2_147_483_647
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.int32(127).bit_count() 7 >>> np.int32(-127).bit_count() 7
- class arkouda.numpy.integer(value)¶
Bases:
numpy.number
Abstract base class of all integer scalar types.
- denominator(*args, **kwargs)¶
denominator of value (1)
- is_integer(*args, **kwargs)¶
integer.is_integer() -> bool
Return
True
if the number is finite with integral value.Added in version 1.22.
>>> np.int64(-2).is_integer() True >>> np.uint32(5).is_integer() True
- numerator(*args, **kwargs)¶
numerator of value (the value itself)
- class arkouda.numpy.intp(value)¶
Bases:
numpy.signedinteger
Signed integer type, compatible with Python int and C
long
.- Character code:
'l'
- Canonical name:
numpy.int_
- Alias on this platform (Linux x86_64):
numpy.int64: 64-bit signed integer (
-9_223_372_036_854_775_808
to9_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(*args, **kwargs)¶
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
popcount
in C++.>>> np.int64(127).bit_count() 7 >>> np.int64(-127).bit_count() 7
- arkouda.numpy.isfinite(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise isfinite check applied to the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing boolean values indicating whether the input array elements are finite
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
RuntimeError – if the underlying pdarray is not float-based
Examples
>>> ak.isfinite(ak.array[1.0, 2.0, ak.inf]) array([True, True, False])
- arkouda.numpy.isinf(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise isinf check applied to the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing boolean values indicating whether the input array elements are infinite
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
RuntimeError – if the underlying pdarray is not float-based
Examples
>>> ak.isinf(ak.array[1.0, 2.0, ak.inf]) array([False, False, True])
- arkouda.numpy.isnan(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise isnan check applied to the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing boolean values indicating whether the input array elements are NaN
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
RuntimeError – if the underlying pdarray is not float-based
Examples
>>> ak.isnan(ak.array[1.0, 2.0, 1.0 / 0.0]) array([False, False, True])
- arkouda.numpy.isscalar(element)¶
Returns True if the type of element is a scalar type.
- Parameters:
element (any) – Input argument, can be of any type and shape.
- Returns:
val – True if element is a scalar type, False if it is not.
- Return type:
bool
See also
ndim
Get the number of dimensions of an array
Notes
If you need a stricter way to identify a numerical scalar, use
isinstance(x, numbers.Number)
, as that returnsFalse
for most non-numerical elements such as strings.In most cases
np.ndim(x) == 0
should be used instead of this function, as that will also return true for 0d arrays. This is how numpy overloads functions in the style of thedx
arguments to gradient and thebins
argument to histogram. Some key differences:x
isscalar(x)
np.ndim(x) == 0
PEP 3141 numeric objects (including builtins)
True
True
builtin string and buffer objects
True
True
other builtin objects, like pathlib.Path, Exception, the result of re.compile
False
True
third-party objects like matplotlib.figure.Figure
False
True
zero-dimensional numpy arrays
False
True
other numpy arrays
False
False
list, tuple, and other sequence objects
False
False
Examples
>>> np.isscalar(3.1) True >>> np.isscalar(np.array(3.1)) False >>> np.isscalar([3.1]) False >>> np.isscalar(False) True >>> np.isscalar('numpy') True
NumPy supports PEP 3141 numbers:
>>> from fractions import Fraction >>> np.isscalar(Fraction(5, 17)) True >>> from numbers import Number >>> np.isscalar(Number()) True
- arkouda.numpy.issctype(rep)¶
Determines whether the given object represents a scalar data-type.
- Parameters:
rep (any) – If rep is an instance of a scalar dtype, True is returned. If not, False is returned.
- Returns:
out – Boolean result of check whether rep is a scalar dtype.
- Return type:
bool
See also
issubsctype
,issubdtype
,obj2sctype
,sctype2char
Examples
>>> np.issctype(np.int32) True >>> np.issctype(list) False >>> np.issctype(1.1) False
Strings are also a scalar type:
>>> np.issctype(np.dtype('str')) True
- arkouda.numpy.issubclass_(arg1, arg2)¶
Determine if a class is a subclass of a second class.
issubclass_ is equivalent to the Python built-in
issubclass
, except that it returns False instead of raising a TypeError if one of the arguments is not a class.- Parameters:
arg1 (class) – Input class. True is returned if arg1 is a subclass of arg2.
arg2 (class or tuple of classes.) – Input class. If a tuple of classes, True is returned if arg1 is a subclass of any of the tuple elements.
- Returns:
out – Whether arg1 is a subclass of arg2 or not.
- Return type:
bool
See also
issubsctype
,issubdtype
,issctype
Examples
>>> np.issubclass_(np.int32, int) False >>> np.issubclass_(np.int32, float) False >>> np.issubclass_(np.float64, float) True
- arkouda.numpy.issubdtype(arg1, arg2)¶
Returns True if first argument is a typecode lower/equal in type hierarchy.
This is like the builtin
issubclass()
, but for dtypes.- Parameters:
arg1 (dtype_like) – dtype or object coercible to one
arg2 (dtype_like) – dtype or object coercible to one
- Returns:
out
- Return type:
bool
Examples
issubdtype can be used to check the type of arrays:
>>> ints = np.array([1, 2, 3], dtype=np.int32) >>> np.issubdtype(ints.dtype, np.integer) True >>> np.issubdtype(ints.dtype, np.floating) False
>>> floats = np.array([1, 2, 3], dtype=np.float32) >>> np.issubdtype(floats.dtype, np.integer) False >>> np.issubdtype(floats.dtype, np.floating) True
Similar types of different sizes are not subdtypes of each other:
>>> np.issubdtype(np.float64, np.float32) False >>> np.issubdtype(np.float32, np.float64) False
but both are subtypes of floating:
>>> np.issubdtype(np.float64, np.floating) True >>> np.issubdtype(np.float32, np.floating) True
For convenience, dtype-like objects are allowed too:
>>> np.issubdtype('S1', np.string_) True >>> np.issubdtype('i4', np.signedinteger) True
- arkouda.numpy.log(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise natural log of the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing natural log values of the input array elements
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Notes
Logarithms with other bases can be computed as follows:
Examples
>>> A = ak.array([1, 10, 100]) # Natural log >>> ak.log(A) array([0, 2.3025850929940459, 4.6051701859880918]) # Log base 10 >>> ak.log(A) / np.log(10) array([0, 1, 2]) # Log base 2 >>> ak.log(A) / np.log(2) array([0, 3.3219280948873626, 6.6438561897747253])
- arkouda.numpy.log10(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise base 10 log of the array.
- Parameters:
pda (pdarray) – array to compute on
- Return type:
pdarray contain values of the base 10 log
- arkouda.numpy.log1p(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise natural log of one plus the array.
- Parameters:
pda (pdarray) – array to compute on
- Return type:
pdarray contain values of the natural log of one plus the array
- arkouda.numpy.log2(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise base 2 log of the array.
- Parameters:
pda (pdarray) – array to compute on
- Return type:
pdarray contain values of the base 2 log
- class arkouda.numpy.longdouble(value)¶
Bases:
numpy.floating
- Extended-precision floating-point number type, compatible with C
long double
but not necessarily with IEEE 754 quadruple-precision.- Character code:
'g'
- Alias:
numpy.longfloat
- Alias on this platform (Linux x86_64):
numpy.float128: 128-bit extended-precision floating-point number type.
- as_integer_ratio(*args, **kwargs)¶
longdouble.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.longdouble(10.0).as_integer_ratio() (10, 1) >>> np.longdouble(0.0).as_integer_ratio() (0, 1) >>> np.longdouble(-.25).as_integer_ratio() (-1, 4)
- is_integer(*args, **kwargs)¶
longdouble.is_integer() -> bool
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
>>> np.longdouble(-2.0).is_integer() True >>> np.longdouble(3.2).is_integer() False
- class arkouda.numpy.longfloat(value)¶
Bases:
numpy.floating
- Extended-precision floating-point number type, compatible with C
long double
but not necessarily with IEEE 754 quadruple-precision.- Character code:
'g'
- Alias:
numpy.longfloat
- Alias on this platform (Linux x86_64):
numpy.float128: 128-bit extended-precision floating-point number type.
- as_integer_ratio(*args, **kwargs)¶
longdouble.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.longdouble(10.0).as_integer_ratio() (10, 1) >>> np.longdouble(0.0).as_integer_ratio() (0, 1) >>> np.longdouble(-.25).as_integer_ratio() (-1, 4)
- is_integer(*args, **kwargs)¶
longdouble.is_integer() -> bool
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
>>> np.longdouble(-2.0).is_integer() True >>> np.longdouble(3.2).is_integer() False
- class arkouda.numpy.longlong(value)¶
Bases:
numpy.signedinteger
Signed integer type, compatible with C
long long
.- Character code:
'q'
- bit_count(*args, **kwargs)¶
- arkouda.numpy.matmul(pdaLeft: arkouda.pdarrayclass.pdarray, pdaRight: arkouda.pdarrayclass.pdarray)[source]¶
Compute the product of two matrices.
- Parameters:
- Returns:
the matrix product pdaLeft x pdaRight
- Return type:
Examples
>>> a = ak.array([[1,2,3,4,5],[1,2,3,4,5]]) >>> b = ak.array(([1,1],[2,2],[3,3],[4,4],[5,5]]) >>> ak.matmul(a,b) array([array([30 30]) array([45 45])])
>>> x = ak.array([[1,2,3],[1.1,2.1,3.1]]) >>> y = ak.array([[1,1,1],[0,2,2],[0,0,3]]) >>> ak.matmul(x,y) array([array([1.00000000000000000 5.00000000000000000 14.00000000000000000]) array([1.1000000000000001 5.3000000000000007 14.600000000000001])])
Notes
Server returns an error if shapes of pdaLeft and pdaRight are incompatible with matrix multiplication.
- arkouda.numpy.maximum_sctype(t)¶
Return the scalar type of highest precision of the same kind as the input.
- Parameters:
t (dtype or dtype specifier) – The input data type. This can be a dtype object or an object that is convertible to a dtype.
- Returns:
out – The highest precision data type of the same kind (dtype.kind) as t.
- Return type:
dtype
See also
obj2sctype
,mintypecode
,sctype2char
,dtype
Examples
>>> np.maximum_sctype(int) <class 'numpy.int64'> >>> np.maximum_sctype(np.uint8) <class 'numpy.uint64'> >>> np.maximum_sctype(complex) <class 'numpy.complex256'> # may vary
>>> np.maximum_sctype(str) <class 'numpy.str_'>
>>> np.maximum_sctype('i2') <class 'numpy.int64'> >>> np.maximum_sctype('f4') <class 'numpy.float128'> # may vary
- arkouda.numpy.median(pda)[source]¶
Compute the median of a given array. 1d case only, for now.
- Parameters:
pda (pdarray) – The input data, in pdarray form, numeric type or boolean
- Returns:
The median of the entire pdarray The array is sorted, and then if the number of elements is odd,
the return value is the middle element. If even, then the mean of the two middle elements.
- Return type:
np.float64
Examples
>>> import arkouda as ak >>> arkouda.connect() >>> pda = ak.array ([0,4,7,8,1,3,5,2,-1]) >>> ak.median(pda) 3 >>> pda = ak.array([0,1,3,3,1,2,3,4,2,3]) 2.5
- arkouda.numpy.nan: float¶
- class arkouda.numpy.number(value)¶
Bases:
numpy.generic
Abstract base class of all numeric scalar types.
- class arkouda.numpy.numeric_and_bool_scalars(origin, params, *, inst=True, name=None)¶
Bases:
_GenericAlias
The central part of 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.numeric_scalars(origin, params, *, inst=True, name=None)¶
Bases:
_GenericAlias
The central part of 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.numpy_scalars(origin, params, *, inst=True, name=None)¶
Bases:
_GenericAlias
The central part of 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.object_(value)¶
Bases:
numpy.generic
Any Python object.
- Character code:
'O'
- arkouda.numpy.pi: float¶
- arkouda.numpy.putmask(A: arkouda.pdarrayclass.pdarray, mask: arkouda.pdarrayclass.pdarray, Values: arkouda.pdarrayclass.pdarray)[source]¶
Overwrites elements of A with elements from B based upon a mask array. Similar to numpy.putmask, where mask = False, A retains its original value, but where mask = True, A is overwritten with the corresponding entry from Values.
This is similar to ak.where, except that (1) no new pdarray is created, and (2) Values does not have to be the same size as A and mask.
- Parameters:
Examples
>>> a = ak.array(np.arange(10)) >>> ak.putmask (a,a>2,a**2) >>> a array ([0,1,2,9,16,25,36,49,64,81])
>>> a = ak.array(np.arange(10)) >>> values = ak.array([3,2]) >>> ak.putmask (a,a>2,values) >>> a array ([0,1,2,2,3,2,3,2,3,2])
- Raises:
RuntimeError – Raised if mask is not same size as A, or if A.dtype and Values.dtype are not an allowed pair (see Notes for details).
Notes
A and mask must be the same size. Values can be any size.
Allowed dtypes for A and Values conform to types accepted by numpy putmask.
If A is ak.float64, Values can be ak.float64, ak.int64, ak.uint64, ak.bool_.
If A is ak.int64, Values can be ak.int64 or ak.bool_.
If A is ak.uint64, Values can be ak.int64, ak.uint64, or ak.bool_.
If A is ak.bool_, Values must be ak.bool_.
Only one conditional clause is supported e.g., n < 5, n > 1, which is supported in numpy is not currently supported in Arkouda
Only 1D pdarrays are implemented for now.
- arkouda.numpy.rad2deg(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Converts angles element-wise from radians to degrees.
- Parameters:
- Returns:
A pdarray containing an angle converted to degrees, from radians, for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.resolve_scalar_dtype(val: object) str [source]¶
Try to infer what dtype arkouda_server should treat val as.
- arkouda.numpy.round(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise rounding of the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing input array elements rounded to the nearest integer
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Examples
>>> ak.round(ak.array([1.1, 2.5, 3.14159])) array([1, 3, 3])
- class arkouda.numpy.sctypeDict¶
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(*args, **kwargs)¶
D.clear() -> None. Remove all items from D.
- copy(*args, **kwargs)¶
D.copy() -> a shallow copy of D
- 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(*args, **kwargs)¶
D.items() -> a set-like object providing a view on D’s items
- keys(*args, **kwargs)¶
D.keys() -> a set-like object providing a view on D’s keys
- pop(*args, **kwargs)¶
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, default is returned if given, otherwise KeyError is raised
- 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 dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: 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(*args, **kwargs)¶
D.values() -> an object providing a view on D’s values
- class arkouda.numpy.sctypes¶
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(*args, **kwargs)¶
D.clear() -> None. Remove all items from D.
- copy(*args, **kwargs)¶
D.copy() -> a shallow copy of D
- 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(*args, **kwargs)¶
D.items() -> a set-like object providing a view on D’s items
- keys(*args, **kwargs)¶
D.keys() -> a set-like object providing a view on D’s keys
- pop(*args, **kwargs)¶
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, default is returned if given, otherwise KeyError is raised
- 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 dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: 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(*args, **kwargs)¶
D.values() -> an object providing a view on D’s values
- arkouda.numpy.shape(a: arkouda.pdarrayclass.pdarray | arkouda.strings.Strings | bool | numpy.bool_ | float | numpy.float64 | numpy.float32 | int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 | numpy.str_ | str) Tuple [source]¶
Return the shape of an array.
- Parameters:
a (pdarray) – Input array.
- Returns:
shape – The elements of the shape tuple give the lengths of the corresponding array dimensions.
- Return type:
tuple of ints
Examples
>>> import arkouda as ak >>> ak.shape(ak.eye(3,2)) (3, 2) >>> ak.shape([[1, 3]]) (1, 2) >>> ak.shape([0]) (1,) >>> ak.shape(0) ()
- class arkouda.numpy.short(value)¶
Bases:
numpy.signedinteger
Signed 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_768
to32_767
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.int16(127).bit_count() 7 >>> np.int16(-127).bit_count() 7
- arkouda.numpy.sign(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise sign of the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing sign values of the input array elements
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Examples
>>> ak.sign(ak.array([-10, -5, 0, 5, 10])) array([-1, -1, 0, 1, 1])
- class arkouda.numpy.signedinteger(value)¶
Bases:
numpy.integer
Abstract base class of all signed integer scalar types.
- arkouda.numpy.sin(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise sine of the array.
- Parameters:
- Returns:
A pdarray containing sin for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- class arkouda.numpy.single(value)¶
Bases:
numpy.floating
Single-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(*args, **kwargs)¶
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(*args, **kwargs)¶
single.is_integer() -> bool
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
>>> np.single(-2.0).is_integer() True >>> np.single(3.2).is_integer() False
- arkouda.numpy.sinh(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise hyperbolic sine of the array.
- Parameters:
- Returns:
A pdarray containing hyperbolic sine for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.square(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise square of the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing square values of the input array elements
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Examples
>>> ak.square(ak.arange(1,5)) array([1, 4, 9, 16])
- arkouda.numpy.squeeze(x: arkouda.pdarrayclass.pdarray | float | numpy.float64 | numpy.float32 | int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 | bool | numpy.bool_, /, axis: NoneType | int | Tuple[int, Ellipsis] = None) arkouda.pdarrayclass.pdarray [source]¶
Remove degenerate (size one) dimensions from an array.
- Parameters:
x (pdarray) – The array to squeeze
axis (int or Tuple[int, ...]) – The axis or axes to squeeze (must have a size of one). If axis = None, all dimensions of size 1 will be squeezed.
- Returns:
A copy of x with the dimensions specified in the axis argument removed.
- Return type:
Examples
>>> import arkouda as ak >>> ak.connect() >>> x = ak.arange(10).reshape((1, 10, 1)) >>> x array([array([array([0]) array([1]) array([2]) array([3]).... array([4]) array([5]) array([6]) array([7]) array([8]) array([9])])]) >>> x.shape (1, 10, 1) >>> ak.squeeze(x,axis=None) array([0 1 2 3 4 5 6 7 8 9]) >>> ak.squeeze(x,axis=None).shape (10,) >>> ak.squeeze(x,axis=2) array([array([0 1 2 3 4 5 6 7 8 9])]) >>> ak.squeeze(x,axis=2).shape (1, 10) >>> ak.squeeze(x,axis=(0,2)) array([0 1 2 3 4 5 6 7 8 9]) >>> ak.squeeze(x,axis=(0,2)).shape (10,)
- class arkouda.numpy.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'
- Alias:
numpy.unicode_
- T(*args, **kwargs)¶
Scalar attribute identical to the corresponding array attribute.
Please see ndarray.T.
- all(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.all.
- any(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.any.
- argmax(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.argmax.
- argmin(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.argmin.
- argsort(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.argsort.
- astype(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.astype.
- base(*args, **kwargs)¶
Scalar attribute identical to the corresponding array attribute.
Please see ndarray.base.
- byteswap(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.byteswap.
- choose(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.choose.
- clip(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.clip.
- compress(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.compress.
- conj(*args, **kwargs)¶
- conjugate(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.conjugate.
- copy(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.copy.
- cumprod(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.cumprod.
- cumsum(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.cumsum.
- data(*args, **kwargs)¶
Pointer to start of data.
- diagonal(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.diagonal.
- dtype(*args, **kwargs)¶
Get array data-descriptor.
- dump(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.dump.
- dumps(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.dumps.
- fill(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.fill.
- flags(*args, **kwargs)¶
The integer value of flags.
- flat(*args, **kwargs)¶
A 1-D view of the scalar.
- flatten(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.flatten.
- getfield(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.getfield.
- imag(*args, **kwargs)¶
The imaginary part of the scalar.
- item(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.item.
- itemset(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.itemset.
- itemsize(*args, **kwargs)¶
The length of one element in bytes.
- max(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.max.
- mean(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.mean.
- min(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.min.
- nbytes(*args, **kwargs)¶
The length of the scalar in bytes.
- ndim(*args, **kwargs)¶
The number of array dimensions.
- newbyteorder(*args, **kwargs)¶
newbyteorder(new_order=’S’, /)
Return a new dtype with a different byte order.
Changes are also made in all fields and sub-arrays of the data type.
The new_order code can be any from the following:
‘S’ - swap dtype from current to opposite endian
{‘<’, ‘little’} - little endian
{‘>’, ‘big’} - big endian
{‘=’, ‘native’} - native order
{‘|’, ‘I’} - ignore (no change to byte order)
- new_orderstr, optional
Byte order to force; a value from the byte order specifications above. The default value (‘S’) results in swapping the current byte order.
- new_dtypedtype
New dtype object with the given change to the byte order.
- nonzero(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.nonzero.
- prod(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.prod.
- ptp(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.ptp.
- put(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.put.
- ravel(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.ravel.
- real(*args, **kwargs)¶
The real part of the scalar.
- repeat(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.repeat.
- reshape(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.reshape.
- resize(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.resize.
- round(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.round.
- searchsorted(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.searchsorted.
- setfield(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.setfield.
- setflags(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.setflags.
- shape(*args, **kwargs)¶
Tuple of array dimensions.
- size(*args, **kwargs)¶
The number of elements in the gentype.
- sort(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.sort.
- squeeze(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.squeeze.
- std(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.std.
- strides(*args, **kwargs)¶
Tuple of bytes steps in each dimension.
- sum(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.sum.
- swapaxes(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.swapaxes.
- take(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.take.
- tobytes(*args, **kwargs)¶
- tofile(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.tofile.
- tolist(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.tolist.
- tostring(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.tostring.
- trace(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.trace.
- transpose(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.transpose.
- var(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.var.
- view(*args, **kwargs)¶
Scalar method identical to the corresponding array attribute.
Please see ndarray.view.
- class arkouda.numpy.str_scalars(origin, params, *, inst=True, name=None)¶
Bases:
_GenericAlias
The central part of 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.
- arkouda.numpy.tan(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise tangent of the array.
- Parameters:
- Returns:
A pdarray containing tangent for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- arkouda.numpy.tanh(pda: arkouda.pdarrayclass.pdarray, where: bool | arkouda.pdarrayclass.pdarray = True) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise hyperbolic tangent of the array.
- Parameters:
- Returns:
A pdarray containing hyperbolic tangent for each element of the original pdarray
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
- class arkouda.numpy.timedelta64(value)¶
Bases:
numpy.signedinteger
A timedelta stored as a 64-bit integer.
See arrays.datetime for more information.
- Character code:
'm'
- arkouda.numpy.transpose(pda: arkouda.pdarrayclass.pdarray)[source]¶
Compute the transpose of a matrix.
Examples
>>> a = ak.array([[1,2,3,4,5],[1,2,3,4,5]]) >>> ak.transpose(a) array([array([1 1]) array([2 2]) array([3 3]) array([4 4]) array([5 5])])
Notes
Server returns an error if rank of pda < 2
- arkouda.numpy.tril(pda: arkouda.pdarrayclass.pdarray, diag: int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 = 0)[source]¶
Return a copy of the pda with the upper triangle zeroed out
- Parameters:
pda (pdarray)
diag (int_scalars) – if diag = 0, zeros start just below the main diagonal if diag = 1, zeros start at the main diagonal if diag = 2, zeros start just above the main diagonal etc.
- Returns:
a copy of pda with zeros in the upper triangle
- Return type:
Examples
>>> a = ak.array([[1,2,3,4,5],[2,3,4,5,6],[3,4,5,6,7],[4,5,6,7,8],[5,6,7,8,9]]) >>> ak.tril(a,diag=4) array([array([1 2 3 4 5]) array([2 3 4 5 6]) array([3 4 5 6 7]) array([4 5 6 7 8]) array([5 6 7 8 9])]) >>> ak.tril(a,diag=3) array([array([1 2 3 4 0]) array([2 3 4 5 6]) array([3 4 5 6 7]) array([4 5 6 7 8]) array([5 6 7 8 9])]) >>> ak.tril(a,diag=2) array([array([1 2 3 0 0]) array([2 3 4 5 0]) array([3 4 5 6 7]) array([4 5 6 7 8]) array([5 6 7 8 9])]) >>> ak.tril(a,diag=1) array([array([1 2 0 0 0]) array([2 3 4 0 0]) array([3 4 5 6 0]) array([4 5 6 7 8]) array([5 6 7 8 9])]) >>> ak.tril(a,diag=0) array([array([1 0 0 0 0]) array([2 3 0 0 0]) array([3 4 5 0 0]) array([4 5 6 7 0]) array([5 6 7 8 9])])
Notes
Server returns an error if rank of pda < 2
- arkouda.numpy.triu(pda: arkouda.pdarrayclass.pdarray, diag: int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 = 0)[source]¶
Return a copy of the pda with the lower triangle zeroed out
- Parameters:
pda (pdarray)
diag (int_scalars) – if diag = 0, zeros start just above the main diagonal if diag = 1, zeros start at the main diagonal if diag = 2, zeros start just below the main diagonal etc.
- Returns:
a copy of pda with zeros in the lower triangle
- Return type:
Examples
>>> a = ak.array([[1,2,3,4,5],[2,3,4,5,6],[3,4,5,6,7],[4,5,6,7,8],[5,6,7,8,9]]) >>> ak.triu(a,diag=0) array([array([1 2 3 4 5]) array([0 3 4 5 6]) array([0 0 5 6 7]) array([0 0 0 7 8]) array([0 0 0 0 9])]) >>> ak.triu(a,diag=1) array([array([0 2 3 4 5]) array([0 0 4 5 6]) array([0 0 0 6 7]) array([0 0 0 0 8]) array([0 0 0 0 0])]) >>> ak.triu(a,diag=2) array([array([0 0 3 4 5]) array([0 0 0 5 6]) array([0 0 0 0 7]) array([0 0 0 0 0]) array([0 0 0 0 0])]) >>> ak.triu(a,diag=3) array([array([0 0 0 4 5]) array([0 0 0 0 6]) array([0 0 0 0 0]) array([0 0 0 0 0]) array([0 0 0 0 0])]) >>> ak.triu(a,diag=4) array([array([0 0 0 0 5]) array([0 0 0 0 0]) array([0 0 0 0 0]) array([0 0 0 0 0]) array([0 0 0 0 0])])
Notes
Server returns an error if rank of pda < 2
- arkouda.numpy.trunc(pda: arkouda.pdarrayclass.pdarray) arkouda.pdarrayclass.pdarray [source]¶
Return the element-wise truncation of the array.
- Parameters:
pda (pdarray)
- Returns:
A pdarray containing input array elements truncated to the nearest integer
- Return type:
- Raises:
TypeError – Raised if the parameter is not a pdarray
Examples
>>> ak.trunc(ak.array([1.1, 2.5, 3.14159])) array([1, 2, 3])
- arkouda.numpy.typename(char)¶
Return a description for the given data type code.
- Parameters:
char (str) – Data type code.
- Returns:
out – Description of the input data type code.
- Return type:
str
See also
dtype
,typecodes
Examples
>>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] >>> for typechar in typechars: ... print(typechar, ' : ', np.typename(typechar)) ... S1 : character ? : bool B : unsigned char D : complex double precision G : complex long double precision F : complex single precision I : unsigned integer H : unsigned short L : unsigned long integer O : object Q : unsigned long long integer S : string U : unicode V : void b : signed char d : double precision g : long precision f : single precision i : integer h : short l : long integer q : long long integer
- class arkouda.numpy.ubyte(value)¶
Bases:
numpy.unsignedinteger
Unsigned 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 (
0
to255
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.uint8(127).bit_count() 7
- class arkouda.numpy.uint(value)¶
Bases:
numpy.unsignedinteger
Unsigned integer type, compatible with C
unsigned long
.- Character code:
'L'
- Canonical name:
numpy.uint
- Alias on this platform (Linux x86_64):
numpy.uint64: 64-bit unsigned integer (
0
to18_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(*args, **kwargs)¶
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
popcount
in C++.>>> np.uint64(127).bit_count() 7
- class arkouda.numpy.uint16(value)¶
Bases:
numpy.unsignedinteger
Unsigned 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 (
0
to65_535
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.uint16(127).bit_count() 7
- class arkouda.numpy.uint32(value)¶
Bases:
numpy.unsignedinteger
Unsigned 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 (
0
to4_294_967_295
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.uint32(127).bit_count() 7
- class arkouda.numpy.uint64(value)¶
Bases:
numpy.unsignedinteger
Unsigned integer type, compatible with C
unsigned long
.- Character code:
'L'
- Canonical name:
numpy.uint
- Alias on this platform (Linux x86_64):
numpy.uint64: 64-bit unsigned integer (
0
to18_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(*args, **kwargs)¶
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
popcount
in C++.>>> np.uint64(127).bit_count() 7
- class arkouda.numpy.uint8(value)¶
Bases:
numpy.unsignedinteger
Unsigned 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 (
0
to255
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.uint8(127).bit_count() 7
- class arkouda.numpy.uintc(value)¶
Bases:
numpy.unsignedinteger
Unsigned 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 (
0
to4_294_967_295
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.uint32(127).bit_count() 7
- class arkouda.numpy.uintp(value)¶
Bases:
numpy.unsignedinteger
Unsigned integer type, compatible with C
unsigned long
.- Character code:
'L'
- Canonical name:
numpy.uint
- Alias on this platform (Linux x86_64):
numpy.uint64: 64-bit unsigned integer (
0
to18_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(*args, **kwargs)¶
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
popcount
in C++.>>> np.uint64(127).bit_count() 7
- class arkouda.numpy.ulonglong(value)¶
Bases:
numpy.unsignedinteger
Signed integer type, compatible with C
unsigned long long
.- Character code:
'Q'
- bit_count(*args, **kwargs)¶
- class arkouda.numpy.unsignedinteger(value)¶
Bases:
numpy.integer
Abstract base class of all unsigned integer scalar types.
- class arkouda.numpy.ushort(value)¶
Bases:
numpy.unsignedinteger
Unsigned 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 (
0
to65_535
).
- bit_count(*args, **kwargs)¶
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
popcount
in C++.>>> np.uint16(127).bit_count() 7
- arkouda.numpy.value_counts(pda: arkouda.pdarrayclass.pdarray) tuple [source]¶
Count the occurrences of the unique values of an array.
- Parameters:
- Returns:
unique_values (pdarray, int64 or Strings) – The unique values, sorted in ascending order
counts (pdarray, int64) – The number of times the corresponding unique value occurs
- Raises:
TypeError – Raised if the parameter is not a pdarray
See also
unique
,histogram
Notes
This function differs from
histogram()
in that it only returns counts for values that are present, leaving out empty “bins”. This function delegates all logic to the unique() method where the return_counts parameter is set to True.Examples
>>> A = ak.array([2, 0, 2, 4, 0, 0]) >>> ak.value_counts(A) (array([0, 2, 4]), array([3, 2, 1]))
- arkouda.numpy.vecdot(x1: arkouda.pdarrayclass.pdarray, x2: arkouda.pdarrayclass.pdarray)[source]¶
Compute the generalized dot product of two vectors along the given axis. Assumes that both tensors have already been broadcast to the same shape.
Examples
>>> a = ak.array([[1,2,3,4,5],[1,2,3,4,5]]) >>> b = ak.array(([2,2,2,2,2],[2,2,2,2,2]]) >>> ak.vecdot(a,b) array([5 10 15 20 25]) >>> ak.vecdot(b,a) array([5 10 15 20 25])
- Raises:
ValueTypeError – Raised if x1 and x2 are not of matching shape or if rank of x1 < 2
- class arkouda.numpy.void(value)¶
Bases:
numpy.flexible
np.void(length_or_data, /, dtype=None)
Create a new structured or unstructured void scalar.
- length_or_dataint, array-like, bytes-like, object
One of multiple meanings (see notes). The length or bytes data of an unstructured void. Or alternatively, the data to be stored in the new scalar when dtype is provided. This can be an array-like, in which case an array may be returned.
- dtypedtype, optional
If provided the dtype of the new scalar. This dtype must be “void” dtype (i.e. a structured or unstructured void, see also defining-structured-types).
..versionadded:: 1.24
For historical reasons and because void scalars can represent both arbitrary byte data and structured dtypes, the void constructor has three calling conventions:
np.void(5)
creates adtype="V5"
scalar filled with five\0
bytes. The 5 can be a Python or NumPy integer.np.void(b"bytes-like")
creates a void scalar from the byte string. The dtype itemsize will match the byte string length, here"V10"
.When a
dtype=
is passed the call is roughly the same as an array creation. However, a void scalar rather than array is returned.
Please see the examples which show all three different conventions.
>>> np.void(5) void(b'\x00\x00\x00\x00\x00') >>> np.void(b'abcd') void(b'\x61\x62\x63\x64') >>> np.void((5, 3.2, "eggs"), dtype="i,d,S5") (5, 3.2, b'eggs') # looks like a tuple, but is `np.void` >>> np.void(3, dtype=[('x', np.int8), ('y', np.int8)]) (3, 3) # looks like a tuple, but is `np.void`
- Character code:
'V'
- arkouda.numpy.where(condition: arkouda.pdarrayclass.pdarray, A: str | float | numpy.float64 | numpy.float32 | int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 | arkouda.pdarrayclass.pdarray | arkouda.strings.Strings | Categorical, B: str | float | numpy.float64 | numpy.float32 | int | numpy.int8 | numpy.int16 | numpy.int32 | numpy.int64 | numpy.uint8 | numpy.uint16 | numpy.uint32 | numpy.uint64 | arkouda.pdarrayclass.pdarray | arkouda.strings.Strings | Categorical) arkouda.pdarrayclass.pdarray | arkouda.strings.Strings | Categorical [source]¶
Returns an array with elements chosen from A and B based upon a conditioning array. As is the case with numpy.where, the return array consists of values from the first array (A) where the conditioning array elements are True and from the second array (B) where the conditioning array elements are False.
- Parameters:
condition (pdarray) – Used to choose values from A or B
A (Union[numeric_scalars, str, pdarray, Strings, Categorical]) – Value(s) used when condition is True
B (Union[numeric_scalars, str, pdarray, Strings, Categorical]) – Value(s) used when condition is False
- Returns:
Values chosen from A where the condition is True and B where the condition is False
- Return type:
- Raises:
TypeError – Raised if the condition object is not a pdarray, if A or B is not an int, np.int64, float, np.float64, pdarray, str, Strings, Categorical if pdarray dtypes are not supported or do not match, or multiple condition clauses (see Notes section) are applied
ValueError – Raised if the shapes of the condition, A, and B pdarrays are unequal
Examples
>>> a1 = ak.arange(1,10) >>> a2 = ak.ones(9, dtype=np.int64) >>> cond = a1 < 5 >>> ak.where(cond,a1,a2) array([1, 2, 3, 4, 1, 1, 1, 1, 1])
>>> a1 = ak.arange(1,10) >>> a2 = ak.ones(9, dtype=np.int64) >>> cond = a1 == 5 >>> ak.where(cond,a1,a2) array([1, 1, 1, 1, 5, 1, 1, 1, 1])
>>> a1 = ak.arange(1,10) >>> a2 = 10 >>> cond = a1 < 5 >>> ak.where(cond,a1,a2) array([1, 2, 3, 4, 10, 10, 10, 10, 10])
>>> s1 = ak.array([f'str {i}' for i in range(10)]) >>> s2 = 'str 21' >>> cond = (ak.arange(10) % 2 == 0) >>> ak.where(cond,s1,s2) array(['str 0', 'str 21', 'str 2', 'str 21', 'str 4', 'str 21', 'str 6', 'str 21', 'str 8','str 21'])
>>> c1 = ak.Categorical(ak.array([f'str {i}' for i in range(10)])) >>> c2 = ak.Categorical(ak.array([f'str {i}' for i in range(9, -1, -1)])) >>> cond = (ak.arange(10) % 2 == 0) >>> ak.where(cond,c1,c2) array(['str 0', 'str 8', 'str 2', 'str 6', 'str 4', 'str 4', 'str 6', 'str 2', 'str 8', 'str 0'])
Notes
A and B must have the same dtype and only one conditional clause is supported e.g., n < 5, n > 1, which is supported in numpy is not currently supported in Arkouda