Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
arrays_zip
// remove element "2" from array column "array_col2"
val temp_df = full_df
.withColumn("new_array_col", array_remove($"array_col2",2))
// zip column "array_col1" with newly created column "new_array_col"
val arr_zip_df = temp_df
.withColumn("result", arrays_zip($"array_col1", $"new_array_col"))
.select("array_col1", "new_array_col", "result")
arr_zip_df.show(truncate=false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment