arkouda.numpy

Attributes

Classes

DataSource

DataSource(destpath='.')

False_

Boolean type (True or False), stored as a byte.

RankWarning

Issued by polyfit when the Vandermonde matrix is rank deficient.

ScalarType

Built-in immutable sequence.

TooHardError

max_work was exceeded.

True_

Boolean type (True or False), stored as a byte.

bool_

Boolean type (True or False), stored as a byte.

byte

Signed integer type, compatible with C char.

cdouble

Complex number type composed of two double-precision floating-point

cfloat

Complex number type composed of two double-precision floating-point

character

Abstract base class of all character string scalar types.

clongdouble

Complex number type composed of two extended-precision floating-point

clongfloat

Complex number type composed of two extended-precision floating-point

csingle

Complex number type composed of two single-precision floating-point

double

Double-precision floating-point number type, compatible with Python float

finfo

finfo(dtype)

flexible

Abstract base class of all scalar types without predefined length.

float32

Single-precision floating-point number type, compatible with C float.

float64

Double-precision floating-point number type, compatible with Python float

float_

Double-precision floating-point number type, compatible with Python float

floating

Abstract base class of all floating-point scalar types.

format_parser

Class to convert formats, names, titles description to a dtype.

half

Half-precision floating-point number type.

iinfo

iinfo(type)

inexact

Abstract base class of all numeric scalar types with a (potentially)

int16

Signed integer type, compatible with C short.

int32

Signed integer type, compatible with C int.

int64

Signed integer type, compatible with Python int and C long.

int8

Signed integer type, compatible with C char.

int_

Signed integer type, compatible with Python int and C long.

intc

Signed integer type, compatible with C int.

integer

Abstract base class of all integer scalar types.

intp

Signed integer type, compatible with Python int and C long.

longdouble

Extended-precision floating-point number type, compatible with C

longfloat

Extended-precision floating-point number type, compatible with C

longlong

Signed integer type, compatible with C long long.

number

Abstract base class of all numeric scalar types.

object_

Any Python object.

sctypeDict

dict() -> new empty dictionary

sctypes

dict() -> new empty dictionary

short

Signed integer type, compatible with C short.

signedinteger

Abstract base class of all signed integer scalar types.

single

Single-precision floating-point number type, compatible with C float.

str_

A unicode string.

ubyte

Unsigned integer type, compatible with C unsigned char.

uint

Unsigned integer type, compatible with C unsigned long.

uint16

Unsigned integer type, compatible with C unsigned short.

uint32

Unsigned integer type, compatible with C unsigned int.

uint64

Unsigned integer type, compatible with C unsigned long.

uint8

Unsigned integer type, compatible with C unsigned char.

uintc

Unsigned integer type, compatible with C unsigned int.

uintp

Unsigned integer type, compatible with C unsigned long.

ulonglong

Signed integer type, compatible with C unsigned long long.

unsignedinteger

Abstract base class of all unsigned integer scalar types.

ushort

Unsigned integer type, compatible with C unsigned short.

Functions

add_newdoc(place, obj, doc[, warn_on_python])

Add documentation to an existing object, typically one defined in C

base_repr(number[, base, padding])

Return a string representation of a number in the given base system.

binary_repr(num[, width])

Return the binary representation of the input number as a string.

deprecate(*args, **kwargs)

Issues a DeprecationWarning, adds warning to old_name's

deprecate_with_doc(msg)

Deprecates a function and includes the deprecation in its docstring.

disp(mesg[, device, linefeed])

Display a message on a device.

floor(→ arkouda.pdarrayclass.pdarray)

Return the element-wise floor of the array.

format_float_positional(x[, precision, unique, ...])

Format a floating-point scalar as a decimal string in positional notation.

format_float_scientific(x[, precision, unique, trim, ...])

Format a floating-point scalar as a decimal string in scientific notation.

isscalar(element)

Returns True if the type of element is a scalar type.

issctype(rep)

Determines whether the given object represents a scalar data-type.

issubclass_(arg1, arg2)

Determine if a class is a subclass of a second class.

issubdtype(arg1, arg2)

Returns True if first argument is a typecode lower/equal in type hierarchy.

maximum_sctype(t)

Return the scalar type of highest precision of the same kind as the input.

typename(char)

Return a description for the given data type code.

Module Contents

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.False_(value)

Bases: numpy.generic

Boolean type (True or False), stored as a byte.

Warning

The bool_ type is not a subclass of the int_ type (the bool_ is not even a number type). This is different than Python’s default implementation of bool as a sub-class of int.

Character code:

'?'

arkouda.numpy.Inf: float
arkouda.numpy.Infinity: float
arkouda.numpy.NAN: float
arkouda.numpy.NINF: float
arkouda.numpy.NZERO: float
arkouda.numpy.NaN: float
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.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.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.

Warning

The bool_ type is not a subclass of the int_ type (the bool_ is not even a number type). This is different than Python’s default implementation of bool as a sub-class of int.

Character code:

'?'

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 the tp_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.

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'
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.bool_(value)

Bases: numpy.generic

Boolean type (True or False), stored as a byte.

Warning

The bool_ type is not a subclass of the int_ type (the bool_ is not even a number type). This is different than Python’s default implementation of bool as a sub-class of int.

Character code:

'?'

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 to 127).

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.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.

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.

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.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.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 to print. device needs to have write() and flush() 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() or flush() 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, and False 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
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 and smallest_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

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.

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, and False 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, and False 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, and False otherwise.

Added in version 1.22.

>>> np.double(-2.0).is_integer()
True
>>> np.double(3.2).is_integer()
False
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:

pdarray

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

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

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.

See also

dtype, typename, sctype2char

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')])
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, and False otherwise.

Added in version 1.22.

>>> np.half(-2.0).is_integer()
True
>>> np.half(3.2).is_integer()
False
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 to 32_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 to 2_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 to 9_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 to 127).

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.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 to 9_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.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 to 2_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 to 9_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.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 returns False 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 the dx arguments to gradient and the bins 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

See also

arrays.scalars

Overview of the numpy type hierarchy.

issubsctype, issubclass_

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
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, and False 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, and False 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.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.nan: float
class arkouda.numpy.number(value)

Bases: numpy.generic

Abstract base class of all numeric scalar types.

class arkouda.numpy.object_(value)

Bases: numpy.generic

Any Python object.

Character code:

'O'

arkouda.numpy.pi: float
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

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 to 32_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.signedinteger(value)

Bases: numpy.integer

Abstract base class of all signed integer scalar types.

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, and False otherwise.

Added in version 1.22.

>>> np.single(-2.0).is_integer()
True
>>> np.single(3.2).is_integer()
False
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.

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 to 255).

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 to 18_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 to 65_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 to 4_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 to 18_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 to 255).

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 to 4_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 to 18_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 to 65_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