Spark Scala:根据另一列的值更改列的值

发布于 2025-02-08 20:42:27 字数 318 浏览 0 评论 0原文

我在Spark Scala中是新的(也在Stackov,所以很高兴成为社区的一部分)。有一个我无法执行的查询:

我有此DF,希望每次列“编号”的值为“ 446118”,列“类型”类型“更改为“ P”,以及类型中的所有其他值,请保持相同方式。这不使用column功能。我知道可以使用功能,但我不知道如何在更改另一列的价值的情况下使用另一个列的值。

如果有人帮助我,我会很感激。

在此处输入图像描述

I'm kind of new in Spark Scala (also in StackOv so it's a pleasure to be part of the community). There's a query that I can not perform:

I have this DF where I wish everytime column "number" has the value of "446118", the column "type" change to "P" and all the other values in type, stay the same way. This without using withColumn function. I know could be with function where but I don't know how to use where when it's about changing the value of one column depending of another one.

I would be grateful if someone help me.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文