column_stack#
- ivy.column_stack(arrays, /, *, out=None)[source]#
Create a new array by horizontally stacking the arrays in arrays.
Equivalent to ivy.hstack(arrays), except each zero or one dimensional array x in arrays is first reshaped into a (x.size(), 1) column before being stacked horizontally.
- Parameters:
- Return type:
- Returns:
ret – Stacked input.
Examples
Arrays of different dtypes up to dimension 2. >>> a0 = ivy.array(True) >>> a1 = ivy.array([7]) >>> a2 = ivy.array([[11.3, 13.7]]) >>> ivy.column_stack((a0, a1, a2)) ivy.array([[ 1. , 7. , 11.30000019, 13.69999981]])
Arrays of dimension 3. >>> a = ivy.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) >>> b = ivy.array([[[11, 12]], [[13, 14]]]) >>> ivy.column_stack((a, b)) ivy.array([[[ 1, 2],
[ 3, 4], [11, 12]],
- [[ 5, 6],
[ 7, 8], [13, 14]]])
- Array.column_stack(self, arrays, /, *, out=None)[source]#
ivy.Array instance method variant of ivy.column_stack.
This method simply wraps the function, and so the docstring for ivy.column_stack also applies to this method with minimal changes.
- Parameters:
self (
Array) – Array that will be stacked at the beginning of the provided array iterable.arrays (
Sequence[Union[Array,NativeArray]]) – Arrays to be stacked.out (
Optional[Array], default:None) – Output array.
- Return type:
Array- Returns:
ret – Stacked input.
- Container.column_stack(self, /, xs, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.column_stack.
This method simply wraps the function, and so the docstring for ivy.column_stack also applies to this method with minimal changes.
- Parameters:
self (
Container) – Container with leaves to stack with leaves of other arrays/containers.xs (
Sequence[Union[Container,Array,NativeArray]]) – Container with other leaves to join.key_chains (
Optional[Union[List[str],Dict[str,str],Container]], default:None) – The key-chains to apply or not apply the method to. Default isNone.to_apply (
Union[bool,Container], default:True) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default isTrue.prune_unapplied (
Union[bool,Container], default:False) – Whether to prune key_chains for which the function was not applied. Default isFalse.map_sequences (
Union[bool,Container], default:False) – Whether to also map method to sequences (lists, tuples). Default isFalse.out (
Optional[Container], default:None) – Optional output array, for writing the result to.
- Return type:
Container- Returns:
ret – An output container with the results.