Home > other >  Help: spark Dataframe withColumn methods
Help: spark Dataframe withColumn methods

Time:09-26

1, val df=sqlcontext range (0, 10)
2, val df1=df. WithColumn (" uniform ", dfdata. Col (" IO "))
3, val df2=df. WithColumn (" normal ", randn (seed=27))
The second line is unusual, IO missing; The third line is normal, please explain

CodePudding user response:

Df. WithColumn (" uniform ", dfdata. Col (" IO "))
Df withColumn behind of column can only be selected in df, can't choose from other DataFrame inside the column

CodePudding user response:

 val df=sqlcontext range (0, 10) 
create DataFrame here only id a long field, the field you choose does not exist
  • Related