hikari.utility.numpy_tools

This file contains basic tools to work with numpy objects used in the package.

Functions

str2array(s)

Create a numpy int8 array using its compact representation saved as string.

Module Contents

hikari.utility.numpy_tools.str2array(s)[source]

Create a numpy int8 array using its compact representation saved as string. The input string might contain only digits and special characters. Every individual digit is treated as a new element, while the special characters induce special behaviour and include:

  • slash / - if present, divides main list into multiple sub-lists;

  • hyphen - - the next digit will be read as negative

Please mind that the compact form used as this function’s input is unfit to store floating point numbers or integers with absolute value above 9.

Parameters:

s (str) – input string containing only digits and special characters

Returns:

a two-dimensional numpy array with integers

Return type:

numpy.ndarray