riptable.rt_hstack
Functions
|
stack_rows or hstack_any is the main routine to row stack riptable classes. |
Attributes
- riptable.rt_hstack.hstack_any(itemlist, cls=None, baseclass=None, destroy=False, **kwargs)
stack_rows or hstack_any is the main routine to row stack riptable classes. It stacks categoricals, datasets, time objects, structs. It can now stack a dictionary of numpy arrays to return a single array and a categorical.
- Parameters:
itemlist – a list of objects to stack for arrays, datasets, categoricals a dictionary of numpy arrays
cls (None. the type of class we are stacking) –
baseclass (the baseclass we are stacking) –
destroy (bool, False. Only valid for Datasets) – !! This is dangerous so make sure you do not want the data anymore in the original datasets.
- Returns:
In the case of a list (returns a single new array, dataset, categorical or specified object.)
In the case of a dict (returns a single new array and a new categorical (two objects returned).)
Examples
>>> stack_rows([arange(3), arange(2)]) FastArray([0, 1, 2, 0, 1])
>>> d={'test1':arange(3), 'test2':arange(1), 'test3':arange(2)} >>> arr, cat = stack_rows(d) >>> Dataset({'Data':arr, 'Cat': cat}) # Data Cat - ---- ----- 0 0 test1 1 1 test1 2 2 test1 3 0 test2 4 0 test3 5 1 test3
See also
np.hstack
,rt.Categorical.align
,rt.Dataset.concat_rows
- riptable.rt_hstack.stack_rows