2
這是我用來刪除「。」的命令。從在火花一階DF列數據,是工作的罰款在scala中刪除數據框中的數據空格spark
rfm = rfm.select(regexp_replace(col("tagname"),"\\.","_") as "tagname",col("value"),col("sensor_timestamp")).persist()
但這不是努力消除在同一列數據
rfm = rfm.select(regexp_replace(col("tagname")," ","") as "tagname",col("value"),col("sensor_timestamp")).persist()
沒有錯誤前導空格。它只是無法刪除任何前導空格,我看到在數據
輸入:rfmshow()
+--------------------+-----+----------------+
| tagname |value|timestamp |
+--------------------+-----+----------------+
| P.A |101.5| 1.409643313E12|
| P.A |100.5| 1.409643315E12|
| P.A |100.5| 1.409644709E12|
|P.B | 0.0| 1.40964471E12|
輸出:
+--------------------+-----+----------------+
| tagname |value|timestamp |
+--------------------+-----+----------------+
| P_A |101.5| 1.409643313E12|
| P_A |100.5| 1.409643315E12|
| P_A |100.5| 1.409644709E12|
|P_B | 0.0| 1.40964471E12|
它爲我,所以你能準備一些假/測試數據,執行'rfm.show()'和粘貼到這裏你得到的輸出? –