dataframe如何替换某列元素值_Spark DataFrame:提取某列并修改/ Column更新、替换

1.concat(exprs: Column*): Column

function note: Concatenates multiple input columns together into a single column. The function works with strings, binary and compatible array columns.

我的问题: dateframe中的某列数据"XX_BM", 例如:值为 0008151223000316, 现在我想 把Column("XX_BM")中的所有值 变为:例如:0008151223000316sfjd。0008151223000316 + sfjd

解决方案: in Scalavar tmp = dfval.col("XX_BM")

var result = concat(tmp,lit("sfjd"))

dfval = dfval.withColumn("XX_BM", result)

2.regexp_replace(e: Column, pattern: String, replacement: String): Column

function note: Replace all substrings of the specified string value that match regexp with rep.

我的问题:I got some dataframe with 170 columns. In one column I have a "name" string and this string sometimes can have a special

你可能感兴趣的:(dataframe如何替换某列元素值_Spark DataFrame:提取某列并修改/ Column更新、替换)