-1

I want to create mean for every row but the one of the row don't show up in my code. Here is what the dataframe looks like :

    A           
0   230     235     210     235
1   345     375     385     378
2   222     292     260     292 

And here is my code

df = pd.DataFrame({'A':[230,345,222],' ':[235,375,292],'   ':[210,385,260],'  ':[235,378,292]})
data = df.iloc[:,0:3]
mean = data.mean(axis=0)

and what i got as result

A      265.666667
       300.666667
       285.000000
dtype: float64

I only got 3 mean result but the results should be 4 means. After that I want to average the results again but that is problem for later. Any ideas?

ojasony
  • 49
  • 6

1 Answers1

3

you can use:

df.mean()

output:

A      265.666667
       300.666667
       285.000000
       301.666667
dtype: float64

After that I want to average the results again

you may use:

df.mean().mean()

output:

288.25
kederrac
  • 16,819
  • 6
  • 32
  • 55