0
我有兩個具有相同行數的pyspark數據框,但它們沒有任何公共列。所以我用monotonically_increasing_id()作爲如何使用monotonically_increasing_id連接兩個沒有公共列的pyspark數據框?
from pyspark.sql.functions import monotonically_increasing_id as mi
id=mi()
df1 = df1.withColumn("match_id", id)
cont_data = cont_data.withColumn("match_id", id)
cont_data = cont_data.join(df1,df1.match_id==cont_data.match_id, 'inner').drop(df1.match_id)
但加入後得到的數據幀具有更少的行數增加新的列到他們兩個。 我在這裏錯過了什麼。謝謝
如果數據集沒有任何共同之處,不排序相關的結果將如何模樣?我會說你的數據集是如何排序的隱含/隱式連接條件。 –