我有一個問題陳述,所有列型別都是字串

如果 A 列模式與 C 列匹配,則用 1 更新 Good Stuff,否則 (-)
pyspark、sparksql 中的任何查詢
感謝阿努吉·古普塔
uj5u.com熱心網友回復:
如果我正確理解您的問題,這應該對您有用:
from pyspark.sql.functions import col, when
df.withColumn('Good Stuff', when(col('RouteTypeRankFinal').startsWith(col('Text(RouteRank)')), lit(1)).otherwise(lit('-')))
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/355190.html
