I have a pandas dataframe & want to calculate the average of some certain columns. But, there are some nan values & my lambda function is ignoring the rows with a missing value in any column. What to do? Here is my code.
avgGDP = fdata.apply(lambda x: np.average(x[rows]), axis=1)