I have 32 separate lists of dataframes. I need to merge each list together, I am expecting 32 different dataframes. I know how to merge 1 list of dataframes together, but I am currently doing the calculation 32 different times. I was wondering if there was a simple way to do the same calculation? I currently have this and I know I'm creating a new variable but I don't know how to assign it back to the originial list from the input. "Weather_List" is a list containing every list that contains the dataframes that need to be merged.
sample lists, data and data_day1 contain dataframes that are named "snow", "temp",etc.. weather_list contains the data and data_day1 lists
data = [snow, temp, windspd]
data_day1 = [snow_day1, temp_day1, windspd_day1]
weather_list = [data, data_day1]
def mergedf(item):
reduce(lambda left,right: pd.merge(left,right,on=['Latitude','Longitude'], how = 'outer'), item
[mergedf(items) for items in weather_list]
I need to use each merged dataframe separate later on in my program.