如何在Java中将Spark dataframe中的列值转换为小写/大写?
例如,下面是输入 Dataframe :
name | country | src | city | debit
---------------------------------------------
"foo"| "NZ" | salary | "Auckland" | 15.0
"bar"| "Aus" | investment | "Melbourne"| 12.5
我需要将“city”列转换为小写
name | country | src | city | debit
------------------------------------------------
"foo"| "NZ" | salary | "auckland" | 15.0
"bar"| "Aus" | investment | "melbourne"| 12.5
我在Scala和Python中找到了解决方案,但在Java中没有,如下所示
How to change case of whole column to lowercase?
在java中有一个转换列名的解决方案,但不转换它的数据。
How to lower the case of column names of a data frame but not its values?
如何将列值转换为小写?
1条答案
按热度按时间2izufjch1#
以防有人在寻找答案。下面是根据@blackbishop的建议提出的解决方案