# Write a Python program to Replace NaN values with average of columns # Python code to demonstrate# to replace nan values# with an average of columns  import numpy as np  # Initialising numpy arrayini_array = np.array([[1.3, 2.5, 3.6, np.nan],                       [2.6, 3.3, np.nan, 5.5],                      [2.1, 3.2, 5.4, 6.5]])  # printing initial arrayprint ("initial array", ini_array)  # column meancol_mean = np.nanmean(ini_array, axis = 0)  # printing column meanprint ("columns mean", str(col_mean))  # find indices where nan value is presentinds = np.where(np.isnan(ini_array))  # replace inds with avg of columnini_array[inds] = np.take(col_mean, inds[1])  # printing final arrayprint ("final array", ini_array)