如何传递'vin等于1 idx'更新列的值
+----------+---------+---+
| vin| vinar|idx|
+----------+---------+---+
| wdwer43w| eqr21144| 1|
|Ebntyure43|Evirter45| 2|
+----------+---------+---+
cur='06City'
df4=df4.withColumn('vin',F.when(F.col('vin')==F.col('idx[1]'),cur).otherwise(F.col('vin')))
条件应该是索引等于1,而不是vin:
df4 = df4.withColumn('vin', F.when(F.col('idx') == 1, cur).otherwise(F.col('vin')))
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句