且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 columnSimilarties() Spark scala 之后获取列名

更新时间:2023-11-22 22:49:04

提取列名(这是这里的棘手部分,因为它无法在闭包中计算):

Extract columns names (this is the tricky part here because it cannot be evaluated in the closure):

val names = df.columns

map 条目:

simsPerfect.entries.map {
  case MatrixEntry(i, j, v)  => (names(i.toInt),  names(j.toInt), v)
}