如何在 Pandas 布尔值缩减中获取导致 True 的列名

how to get the column name resulting True in Pandas boolean reduction

我有df,

     0               1              2          A
-0.740485792    -0.299824912    0.169113705    1
 1.120120949    -0.62580736     0.013757667    2
-0.685112999     0.439492717    -0.484524907   3

我正在尝试获取所有值都大于 0 的列名,

我试过了(df > 0).all()

Out[47]: 
 0    False
 1    False
 2    False
 A     True
 dtype: bool

如何只获取为 True 的列名,

我的预期输出是 "A",提前致谢。

关于 sort_index()

的问题 2
 df2 = pd.DataFrame({"A":[3,2,1]}, index=[2,1,0])

 Out[395]:
    A
2   3
1   2
0   1

df2.sort_index(axis=1)

    A
2   3
1   2
0   1

预期输出是,

    A
0   3
1   2
2   1

boolean indexingdf.columns 一起使用:

c = df.columns[(df > 0).all()]
print (c)
Index(['A'], dtype='object')