I have a dataframe with 50 columns. I want to replace NAs with 0 in 10 columns.
What's the simplest, most readable way of doing this?
I was hoping for something like:
cols = ['a', 'b', 'c', 'd']df[cols].fillna(0, inplace=True)
But that gives me ValueError: Must pass DataFrame with boolean values only
.
I found this answer, but it's rather hard to understand.