我正在尝试根据条件更新列。如果条件通过,则应使用字符串+当前行的其他列对其进行更新
updated_df = original_df
.withColumn(
"url", F.when(original_df.id == 13, "something/{}".format(?) -> I want the current row's 'name' column value here.
)
.otherwise(original_df.url)
)
这是正确的方法吗
您可以使用pyspark.sql中的
format_string
方法。函数:doc相关问题 更多 >
编程相关推荐