I have several excel files with data in them in a format similar to this
csv1 csv1
a b c a b c
x 1 2 3 x 3 2 1
y 4 5 6 y 6 5 4
There are 3 csv's total, and I need to create a new csv with the average of each cell.
So csv3 would be as follows
a b c
x (3+1)/2) (2+2)/2 (3+1)/2
y (6+4)/2 etc.
So far I have the files imported but I am not sure how to proceed.
import pandas as pd
def Averager(fileA,fileB,fileC):
csvA=pd.read_csv(fileA)
csvB=pd.read_csv(fileB)
csvC=pd.read_csv(fileC)
g=pd.concat([csvA, csvB, csvC]).groupby(level=0).mean()
print(g)
print(Averager('a.csv','b.csv','c.csv'))