scala에서 dataframe을 생성하는 코드
코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spark.implicits._ | |
val df1 = Seq(("kwdId_1", 0.1, 0.2, 0.0), ("kwdId_2", 0.1, 0.2, 0.5), ("kwdId_3", 0.1, 0.2, 1.0 )).toDF("nccKeywordId", "col1", "col2", "col3") | |
val df2 = Seq(("kwdId_2", 1.0), ("kwdId_3", 0.5), ("kwdId_4", 0.0)).toDF("newNccKeywordId", "col1") |
'우리는 개발자 > Data Engineering' 카테고리의 다른 글
[Spark] None, null? DataFrame 생성시에 java.lang.ClassNotFoundException: scala.Any (0) | 2020.02.28 |
---|---|
[Spark] SchemaField nullable state 변경하는 방법 (0) | 2020.02.28 |
[Spark] UserDefinedFunction (udf) 구현하는 방법 (+예제코드) (0) | 2020.02.27 |
[Spark] Scala joda Datetime 사용하는 방법 (+예제코드) - Days, DateTimeFormat, DateTime (0) | 2020.02.27 |
[Spark] 시작할때 살펴보면 좋은 유용한 사이트 모음 (0) | 2020.02.27 |