Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Restituisce il prodotto cartesiano con un altro dataframe.
Sintassi
crossJoin(other: "DataFrame")
Parametri
| Parametro | Tipo | Descrizione |
|---|---|---|
other |
DataFrame | Lato destro del prodotto cartesiano. |
Restituzioni
DataFrame: dataframe aggiunto.
Examples
from pyspark.sql import Row
df = spark.createDataFrame(
[(14, "Tom"), (23, "Alice"), (16, "Bob")], ["age", "name"])
df2 = spark.createDataFrame(
[Row(height=80, name="Tom"), Row(height=85, name="Bob")])
df.crossJoin(df2.select("height")).select("age", "name", "height"
).orderBy("age", "name", "height").show()
# +---+-----+------+
# |age| name|height|
# +---+-----+------+
# | 14| Tom| 80|
# | 14| Tom| 85|
# | 16| Bob| 80|
# | 16| Bob| 85|
# | 23|Alice| 80|
# | 23|Alice| 85|
# +---+-----+------+