w**2 发帖数: 147 | 1 请教各位,不知道spark dataframe有没有类似pandas df的方法去修改columns name。
比如pandas: df.columns=["a","b"....]
多谢了。 |
Z**0 发帖数: 1119 | 2 Dataframe is immutable. Creating a new Dataframe from the old one using map
function. |
l*******m 发帖数: 1096 | 3 val df_new = df.withColumnRenamed("old", "new") |
Z**0 发帖数: 1119 | 4 Learned a method for DF.
【在 l*******m 的大作中提到】 : val df_new = df.withColumnRenamed("old", "new")
|
w**2 发帖数: 147 | 5 Thank you everyone.
I am using pyspark and I did:
df = df.withColumnRenamed("old","new")
It worked! |