PySpark: How to fillna values in dataframe for specific columns?

前端 未结 2 1262
北荒
北荒 2020-12-01 09:59

I have the following sample DataFrame:

a    | b    | c   | 

1    | 2    | 4   |
0    | null | null| 
null | 3    | 4   |

And I want to rep

2条回答
  •  佛祖请我去吃肉
    2020-12-01 11:03

    df.fillna(0, subset=['a', 'b'])
    

    There is a parameter named subset to choose the columns unless your spark version is lower than 1.3.1

提交回复
热议问题