larray.Array.extend¶
-
Array.
extend
(self, axis, other)[source]¶ Adds an array to self along an axis.
The two arrays must have compatible axes.
Parameters: - axis : axis
Axis along which to extend with input array (other)
- other : Array
Array with compatible axes
Returns: - Array
Array expanded with ‘other’ along ‘axis’.
Examples
>>> nat = Axis('nat=BE,FO') >>> sex = Axis('sex=M,F') >>> sex2 = Axis('sex=U') >>> xtype = Axis('type=type1,type2') >>> arr1 = ones([sex, xtype]) >>> arr1 sex\type type1 type2 M 1.0 1.0 F 1.0 1.0 >>> arr2 = zeros([sex2, xtype]) >>> arr2 sex\type type1 type2 U 0.0 0.0 >>> arr1.extend('sex', arr2) sex\type type1 type2 M 1.0 1.0 F 1.0 1.0 U 0.0 0.0 >>> arr3 = zeros([sex2, nat]) >>> arr3 sex\nat BE FO U 0.0 0.0 >>> arr1.extend('sex', arr3) sex type\nat BE FO M type1 1.0 1.0 M type2 1.0 1.0 F type1 1.0 1.0 F type2 1.0 1.0 U type1 0.0 0.0 U type2 0.0 0.0