pyspark.sql.functions.elt(*inputs: ColumnOrName) → pyspark.sql.column.Column[source]

Returns the n-th input, e.g., returns input2 when n is 2. The function returns NULL if the index exceeds the length of the array and spark.sql.ansi.enabled is set to false. If spark.sql.ansi.enabled is set to true, it throws ArrayIndexOutOfBoundsException for invalid indices.

New in version 3.5.0.

inputsColumn or str

Input columns or strings.


>>> df = spark.createDataFrame([(1, "scala", "java")], ['a', 'b', 'c'])
>>>, df.b, df.c).alias('r')).collect()