StructuredTypeArray

Represents an array of objects defined by the StructuredType spec provided mostly useful as it dispatches to NumPy where things are simple enough to do so

It has a system to dispatch intelligently based on the type of array provided The kinds of structures supported are: OrderedDict, list, and np.ndarray

A simple StructuredTypeArray is one that can just be represented as a single np.ndarray A compound StructuredTypeArray requires either a list or OrderedDict of StructuredTypeArray subarrays

 

__init__(self, stype, num_elements=50, padding_mode='fill', padding_value=None): 
  • stype: StructuredType
  • num_elements: int

    number of default elements in dynamically sized arrays

 

@property
is_simple(self): 

Just returns wheter the core datatype is simple

  • :returns: _

 

@property
dict_like(self): 

 

@property
extension_axis(self): 

Determines which axis to extend when adding more memory to the array

  • :returns: _

 

@property
shape(self): 

 

@property
block_size(self): 

 

@property
append_depth(self): 

 

@property
dtype(self): 

Returns the core data type held by the StructuredType that represents the array

  • :returns: _

 

@property
stype(self): 

Returns the StructuredType that the array holds data for

  • :returns: _

 

@property
array(self): 

 

axis_shape_indeterminate(self, axis): 

Tries to determine if an axis has had any data placed into it or otherwise been given a determined shape

  • axis: Any
  • :returns: _

 

@property
has_indeterminate_shape(self): 

Tries to determine if the entire array has a determined shape

  • axis: Any
  • :returns: _

 

@property
filled_to(self): 

 

set_filling(self, amt, axis=0): 

 

increment_filling(self, inc=1, axis=0): 

 

__len__(self): 

 

empty_array(self, shape=None, num_elements=None): 

Creates empty arrays with (potentially) default elements

The shape handling rules operate like this: if shape is None, we assume we’ll initialize this as an array with a single element to be filled out if shape is (None,) or (n,) we’ll initialize this as an array with multiple elments to be filled out otherwise we’ll just take the specified shape

  • num_elements: Any
  • :returns: _

 

extend_array(self, axis=None): 

 

__setitem__(self, key, value): 

 

set_part(self, key, value): 

Recursively sets parts of an array if not simple, otherwise just delegates to NumPy

  • key: Any
  • value: Any
  • :returns: _

 

__getitem__(self, item): 

 

get_part(self, item, use_full_array=True): 

If simple, delegates to NumPy, otherwise tries to recursively get parts…? Unclear how slicing is best handled here.

  • item: Any
  • :returns: _

 

add_axis(self, which=0, num_elements=None, change_shape=True): 

Adds an axis to the array, generally used for expanding from singular or 1D data to higher dimensional This happens with parse_all and repeated things like that

  • which: Any
  • num_elements: Any
  • :returns: _

 

can_cast(self, val): 

Determines whether val can probably be cast to the right return type and shape without further processing or if that’s definitely not possible

  • val: Any
  • :returns: _

 

append(self, val, axis=0): 

Puts val in the first empty slot in the array

  • val: Any
  • :returns: _

 

extend(self, val, single=True, prepend=False, axis=None): 

Adds the sequence val to the array

  • val: Any
  • single: bool

    a flag that indicates whether val can be treated as a single object or if it needs to be reshapen when handling in non-simple case

  • :returns: _

 

fill(self, array): 

Sets the result array to be the passed array

  • array: str | np.ndarray
  • :returns: _

 

cast_to_array(self, txt): 

Casts a string of things with a given data type to an array of that type and does some optional shape coercion

  • txt: str | iterable[str]
  • :returns: _

 

__repr__(self): 

Feedback

Examples

Templates

Documentation