scala (1) 썸네일형 리스트형 Dataframe에 새로운 칼럼 추가하기 Dataframe에 새로운 칼럼 추가하기 withColumn 메서드를 사용한다. // def withColumn(colName: String,col: org.apache.spark.sql.Column): org.apache.spark.sql.DataFrame val df = List((1, 2),(4, 8)).toDF("col1", "col2") +----+----+ |col1|col2| +----+----+ | 1| 2| | 4| 8| +----+----+ // 1. 특정 값으로 채워진 칼럼 추가 // literal 함수를 사용한다. literal은 프로그래밍 언어의 리터럴 값을 스파크가 이해할 수 있는 값으로 변화한다. // org.apche.spark.sql.functions.lit df.withC.. 이전 1 다음