larray.Array.compact
- Array.compact(display=False, name='array') Array [source]
Detect and remove “useless” axes (ie axes for which values are constant over the whole axis).
- Parameters
- displaybool, optional
Whether to display a message with the name of constant axes which were discarded. Defaults to False.
- namestr, optional
Name to use in the message if display is True. Defaults to “array”.
- Returns
- Array or scalar
Array with constant axes removed.
Examples
>>> a = Array([[1, 2], ... [1, 2]], [Axis('sex=M,F'), Axis('nat=BE,FO')]) >>> a sex\nat BE FO M 1 2 F 1 2 >>> a.compact() nat BE FO 1 2