pyspark.sql.functions.array¶
-
pyspark.sql.functions.
array
(*cols)[source]¶ Creates a new array column.
- Parameters
cols – list of column names (string) or list of
Column
expressions that have the same data type.
>>> df.select(array('age', 'age').alias("arr")).collect() [Row(arr=[2, 2]), Row(arr=[5, 5])] >>> df.select(array([df.age, df.age]).alias("arr")).collect() [Row(arr=[2, 2]), Row(arr=[5, 5])]
New in version 1.4.