zip
arrayCombines multiple arrays element-wise
Syntax
zip(arrays...) Parameters
arrays (array) Two or more arrays to combine
Returns
array An array of arrays, where each sub-array contains corresponding elements from the input arrays
Examples
Input:
zip([1, 2, 3], ["a", "b", "c"]) Output:
[[1, "a"], [2, "b"], [3, "c"]] Input:
zip(.first_names, .last_names) | map(join(" ")) Output:
Combines first and last names The zip() function combines multiple arrays element-wise, creating an array where each element is an array containing the corresponding elements from each input array.
Usage
This function is useful for combining related data from separate columns, creating key-value pairs, or merging parallel arrays into structured data.