How to compare two dataframe and print columns that are different in scala

前端 未结 2 465
时光取名叫无心
时光取名叫无心 2020-12-02 10:59

We have two data frames here:

the expected dataframe:

+------+---------+--------+----------+-------+--------+
|emp_id| emp_city|emp_name| emp_phone|e         


        
2条回答
  •  独厮守ぢ
    2020-12-02 11:19

    
    list_col=[]
    cols=df1.columns
    
    # Prepare list of dataframes/per column
    for col in cols:
      list_col.append(df1.select(col).subtract(df2.select(col)))
    
    # Render/persist
    for  l in list_col :
      if l.count() > 0 :
         l.show()
    

提交回复
热议问题