neuralib.typing.func

neuralib.typing.func.is_iterable(val)[source]

Check if a value is iterable and not a string.

Parameters:

val (Any) – The value to be checked.

Returns:

True if the value is iterable and not a string, False otherwise

Return type:

bool

neuralib.typing.func.is_namedtuple(obj)[source]

Check if is a namedtuple object

Parameters:

obj (Any)

Return type:

bool

neuralib.typing.func.is_numeric_arraylike(arr)[source]

Check if is a numeric arraylike object

Parameters:

arr (ndarray[Any, dtype[T]] | list[T] | tuple[T, ...] | Series | Series) – ArrayLike object

Returns:

Return type:

bool

neuralib.typing.func.flatten_arraylike(ls)[source]

flatten the list

Parameters:

ls (list[ndarray[Any, dtype[T]] | list[T] | tuple[T, ...] | Series | Series])

Returns:

flatten list

Return type:

list[Any]

neuralib.typing.func.array2str(x, sep=' ')[source]

Convert an array-like object to a string with a specified separator.

Parameters:
  • x (ndarray[Any, dtype[T]] | list[T] | tuple[T, ...] | Series | Series) – 1D array-like object.

  • sep – Separator used to join elements. Default is a space.

Returns:

A string representation of the array with elements separated by sep.

Return type:

str