pyxc.core.processor.reducer
Module Contents
Classes
The Reducer class is designed to perform reductions on structured arrays. |
- class pyxc.core.processor.reducer.Reducer[source]
Bases:
listThe Reducer class is designed to perform reductions on structured arrays.
This class is particularly useful when working with large amounts of data and a subset of information or simplified representation is needed. The
reducemethod transforms the structured array to a simpler form based on the specified functions/callables added to the Reducer list. An instance of the Reducer class is a list of functions or tuples with two elements: a function and a list of columns from the array that the function should be applied to. The functions in the list are applied to the structured array in the order they are added to the list.Notes
The structured array must be a 2D structured NumPy array. The structured array is a powerful tool that allows you to manipulate data with different types and sizes. It’s like a 2D table with each column possibly of a different type.
The output of the reduce method is a structured array with new columns corresponding to the results of the applied functions. For example, if the function ‘np.mean’ is applied to the columns ‘x’ and ‘y’ of the array, the output will include the columns ‘x_mean’ and ‘y_mean’.
Methods
reduce(array: ArrayLike) -> np.ndarray
Apply the functions in the Reducer list to the specified array and return the reduced array.
- reduce(array: numpy.ndarray) numpy.ndarray[source]