Nycolas Mancini
Nycolas Mancini

Reputation: 153

Building a list with bool() results

I have the following indexes that I need to compare

index_1=(df[number:,1] > high_value).argmax() 
index_2=(df[number:,0] < low_value).argmax() 

If I run bool(index_tp > index_sl), it will return if the statement is True or False. What I'm trying to achieve here is building a list with all Trues and Falses everytime I add 1 to number. How can I build this list?

Upvotes: 0

Views: 49

Answers (1)

Błotosmętek
Błotosmętek

Reputation: 12927

Probably like this (assuming you want number to run from first to last row of df):

your_list = [ (df[number:,1] > high_value).argmax() >
              (df[number:,0] < low_value).argmax()
              for number in range(0, df.shape[0]) ]

Upvotes: 1

Related Questions