I have the following Pandas Dataframe 'df':
a1 a2 a3 b1
0 0 0 1
1 2 0 2
3 0 0 3
2 4 0 4
How do I get the average value of "a" for from a1, a2, a3, ignoring the 0 value?
a1 a2 a3 b1 avg(a)
0 0 0 1 0
1 2 0 2 1.5
3 0 0 3 3.0
2 4 0 4 3.0
I'm stuck with manual approach where I convert the value > 0 to 1