returns the cartesian product with another dataframe

Solutions on MaxInterview for returns the cartesian product with another dataframe by the best coders in the world

showing results for - "returns the cartesian product with another dataframe"
Vianney
28 Aug 2017
1# Returns the cartesian product with another DataFrame
2
3df.select("age", "name").collect()
4# [Row(age=2, name='Alice'), Row(age=5, name='Bob')]
5df2.select("name", "height").collect()
6# [Row(name='Tom', height=80), Row(name='Bob', height=85)]
7df.crossJoin(df2.select("height")).select(
8  "age", "name", "height").collect()
9# [Row(age=2, name='Alice', height=80), Row(age=2, name='Alice', height=85), Row(age=55, name='Bob', height=80), Row(age=5, name='Bob', height=85)]