mardi 18 février 2020

How can I compare if an element of Data Frame at given location, is greater than or lesser than an external variable?

I have the following

DF = pd.DataFrame()

DF = {....}

I want to do

If(DF.loc[0,col1] > T):
  return(-9999999)

I also want to do,

for i in range(DF.shape[0]):
  if(DF.loc[i,col1] < TENOR):
    Z_index = i

But I get the error:

Truth Value of a series is ambiguous.

I understand what's happening here, but I want to know what's the correct method to implement this.

Aucun commentaire:

Enregistrer un commentaire