Skip to main content
added 3 characters in body
Source Link
Andrew
  • 406
  • 2
  • 7

Since in pandas the addition goes by index and colucolumns, it is enough to simply add up all the dataframes and divide by their number.

import pandas as pd
a=pd.DataFrame([[1,2,3],[4,5,6]])
b=pd.DataFrame([[10,20,30],[40,50,60]],index=[1,0])
list_of_dataframes:list=[a,b]
sum(list_of_dataframes)/len(list_of_dataframes)

Since in pandas the addition goes by index and colu, it is enough to simply add up all the dataframes and divide by their number.

import pandas as pd
a=pd.DataFrame([[1,2,3],[4,5,6]])
b=pd.DataFrame([[10,20,30],[40,50,60]],index=[1,0])
list_of_dataframes:list=[a,b]
sum(list_of_dataframes)/len(list_of_dataframes)

Since in pandas the addition goes by index and columns, it is enough to simply add up all the dataframes and divide by their number.

import pandas as pd
a=pd.DataFrame([[1,2,3],[4,5,6]])
b=pd.DataFrame([[10,20,30],[40,50,60]],index=[1,0])
list_of_dataframes:list=[a,b]
sum(list_of_dataframes)/len(list_of_dataframes)
Source Link
Andrew
  • 406
  • 2
  • 7

Since in pandas the addition goes by index and colu, it is enough to simply add up all the dataframes and divide by their number.

import pandas as pd
a=pd.DataFrame([[1,2,3],[4,5,6]])
b=pd.DataFrame([[10,20,30],[40,50,60]],index=[1,0])
list_of_dataframes:list=[a,b]
sum(list_of_dataframes)/len(list_of_dataframes)