【发布时间】:2020-10-23 03:14:42
【问题描述】:
我需要替换 Spark 数据框中列中的空值。下面是我试过的代码
df=df.na.fill(0,Seq('c_amount')).show()
但它给我一个错误NameError: name 'Seq' is not defined
下面是我的桌子
+------------+--------+
|c_account_id|c_amount|
+------------+--------+
| 1| null|
| 2| 123 |
| 3| null|
+------------+--------+
预期输出
+------------+--------+
|c_account_id|c_amount|
+------------+--------+
| 1| 0|
| 2| 123|
| 3| 0|
+------------+--------+
【问题讨论】:
标签: apache-spark pyspark apache-spark-sql pyspark-dataframes