Multiple conditional average python
<p>What I'm trying to do is a multiple conditional average. It means that I have a list of x variables (of the same length) and I'd like to compute the average of one variable conditioned to the value/range of the others.</p>

<p>The file is:
<a href="https://i.stack.imgur.com/juLJs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/juLJs.png" alt="It is a sample file"></a></p>

<p>The code I tried is: </p>

<pre><code>wb=pd.ExcelFile('file.xlsx')
wb.sheet_names
df=wb.parse('Sheet1')
df[:]
Var1=df['Col1_Name']
Var2=df['Col2_Name']
Var3=df['Col3_Name']
Var4=df['Col4_Name']
Var5=df['Col5_Name']
Var6=df['Col6_Name']

if (Var1 == 0).any() and (Var2 == 0).any() and (Var3 &lt; 0.8).any() and (Var6 == 0).any():
    print sum(Var4)/len(Var4)
</code></pre>

<p>It seems to be ok, but, if I change the conditions, the result is always the same. Moreover I tried to calculate the same on Excel as double check and the result is indeed different..
Could you help me? Thank you :)</p>