Is there a way to more efficiently filter a result on a data frame without having to explicitly save it in a variable and then filter? For instance, in the code below I would like to add something to line 3 to be able to achieve either df1 or df2.
import pandas as pd
df=pd.DataFrame({'A' : [1,2,3,4,5], 'B' : [0,0,0,0,0]})
df=df.var()
df1 = df[df!=0]
df2 = df[df > 3]