I have 30 csv data files from 30 repeated runs of the experiment that I ran. I use the pandas' function read_csv()to read data into a DataFrames list. I would like to create a single DataFrame from this list containing an average of 30 DataFrames for each column. Is there a built-in way to do this?
To clarify, I will talk about the example in the answers below. Let's say I have two DataFrames:
>>> x
A B C
0 -0.264438 -1.026059 -0.619500
1 0.927272 0.302904 -0.032399
2 -0.264273 -0.386314 -0.217601
3 -0.871858 -0.348382 1.100491
>>> y
A B C
0 1.923135 0.135355 -0.285491
1 -0.208940 0.642432 -0.764902
2 1.477419 -1.659804 -0.431375
3 -1.191664 0.152576 0.935773
What is the merge function that I have to use to create a 3D array using a DataFrame? eg.
>>> automagic_merge(x, y)
A B C
0 [-0.264438, 1.923135] [-1.026059, 0.135355] [-0.619500, -0.285491]
1 [ 0.927272, -0.208940] [ 0.302904, 0.642432] [-0.032399, -0.764902]
2 [-0.264273, 1.477419] [-0.386314, -1.659804] [-0.217601, -0.431375]
3 [-0.871858, -1.191664] [-0.348382, 0.152576] [ 1.100491, 0.935773]
so I can calculate average, sem, etc. in these lists instead of the entire column.