Let's say we have a DataFrame:
df = pd.DataFrame({
'D': {'A': 0.810032, 'B': 0.752299, 'C': 0.224038},
'E': {'A': 0.17714, 'B': 0.680405, 'C': 0.769732},
'F': {'A': 0.942959, 'B': 0.436582, 'C': 0.269791}
})
print(df)
D E F
A 0.810032 0.177140 0.942959
B 0.752299 0.680405 0.436582
C 0.224038 0.769732 0.269791
Is it possible to return index and column names into a list of tuples based on a condition, for instance
print(df < 0.25)
D E F
A False True False
B False False False
C True False False
I would like to end up with a list of tuples like:
[('A','E'),('C','D')]
A.lt(.25).stack().loc[lambda df: df].index.to_list()