How can I retrieve the columns in which at least once appears a value < threshold?
For instance:
THRESHOLD = 0
print(df)
Col_1 Col_2 Col_3 Col_4
1 3 5 -9
1 3 5 -9
1 -2 5 -9
print(final_df)
Col_2 Col_4
3 -9
3 -9
-2 -9
I tried with:
df[(df < 0).any(1)]
But it reports the rows, not the columns, in which at least one element < 0 appears.
df.T[(df.T < 0).any(1)].T- gyx-hh