0

Im trying to check if DataFrame1 has a number 1 for position in a column called 'Position' and if its return 1 (or True) it will not put another number 1 on the second DataFrame2, same row/column as the first DataFrame.

df10c['Position'] = np.zeros(489,)

for i in range(0, len(df11c)-1):

df11c['VarV'][i] = (df11c['Close'][i+1] / df11c['Low_D'][i] - 1 )* 100
df11c['VarC'][i] = (df11c['Close'][i+1] / df11c['High_D'][i] - 1 )* 100
df11c.loc[(df11c['VarV']  <= varv) & (df10c['Position'] != 1),'Position'] = 1
df11c.loc[df11c['VarC']  >= varc, 'Position'] = -1


df11c.loc[(df11c['VarV']  <= varv) & (df10c['Position'] != 1),'Position'] = 1

problem is here and idk how to say if df10c['position'] != 1 print a number 1 on df11c

Marcos
  • 1
  • 2
  • Welcome to Stack Overflow. Please read [ask]. I have very little idea what you're trying to say, but this is a common error. If you cannot solve it by following the advice from the linked duplicate, then you will need to try again, explaining the problem much more clearly - start by explaining what libraries you are using (Pandas? or only Numpy?) and show how you set up the initial data, along with a [complete](https://meta.stackoverflow.com/questions/359146) error message. Show exactly what code you wrote in order to try to follow the advice. – Karl Knechtel Nov 25 '21 at 17:13
  • Please [edit] your question to show a [mcve] and the full error message. – Code-Apprentice Nov 25 '21 at 17:15

0 Answers0