我有一个超级简单的数据帧:
rc1.show(5)
rc1.printSchema()
+--------+-----------+
| ID|Case number|
+--------+-----------+
|11034701| JA366925|
|11227287| JB147188|
|11227583| JB147595|
|11227293| JB147230|
|11227634| JB147599|
+--------+-----------+
only showing top 5 rows
root
|-- ID: string (nullable = true)
|-- Case number: string (nullable = true)
我想添加一个新的列,它只是“Case number”列和“aaa”列的串联,所以我用这个来实现:
rc2 = rc1.withColumn("Case numberxx", col("Case number") + "aaa")
rc2.show(5)
然而,就我的一生而言,我无法理解为什么我的新专栏充满了空值:
+--------+-----------+-------------+
| ID|Case number|Case numberxx|
+--------+-----------+-------------+
|11034701| JA366925| null|
|11227287| JB147188| null|
|11227583| JB147595| null|
|11227293| JB147230| null|
|11227634| JB147599| null|
+--------+-----------+-------------+
only showing top 5 rows
为什么会这样?谢谢
好了,伙计们,这很有效:
但是,我不太明白为什么这是空的:
但这没关系
相关问题 更多 >
编程相关推荐