image: https://i.stack.imgur.com/nljvJ.png It won't let me upload because I don't have the reputation points yet, but its a screenshot of the dataframe
I have a pandas dataframe which has each many locations (rows) each with the same years (1990 - 2020) and columns and then many attribute columns with data for each year (row). I want to find the mean of all the years of each column for each location.
This is what I'm tryin but it doesn't work.
location_names_list = ['Central Europe and the Baltics','Caribbean small states'...
world_bank is a pandas dataframe.
world_bank = wb.download(indicator=indicators_list, country=countries, start=1990, end=2019)
for location in location_names_list:
for column in world_bank:
mean_variable = world_bank.loc[location, column].mean()
world_bank.loc[location, column].fillna(mean_variable, inplace=True)