I have multiple data frames with the same column names. How can I get the mean of specific columns ( let's say the column name I want to get is similarity ) from all data frames and put them into a list?
DF1
similarity count
0 0.2 2
1 0.1 3
2 0.46 4
3 0.12 8
4 0.6 10
DF2
similarity count
0 0.2 4
1 0.1 3
2 0.46 5
3 0.12 6
4 0.6 9
Expected Output
[ 0.296, 0.296 ]
CodePudding user response:
I'd use a list comprehension.
[df.similarity.mean() for df in [df1, df2]]