Filling NaN values in only certain columns of a pandas.DataFrame replaces any missing values in the specified columns with a specified value.
Solution for How to fill NaN values in only certain columns of a pandas DataFrame in Python : You can use pandas.DataFrame.fillna() to fill NaN values in only certain columns Use the syntax df[[column_names]] to select the columns specified by the list column_names from the DataFrame df. Call pandas.DataFrame.fillna(value) with pandas.DataFrame as the result from the previous step to replace each NaN in pandas.DataFrame with value.