vendredi 1 janvier 2021

How to do if and statement on a particular row, and if true to sent a message with row contents to my phone in Python?

So I am running live data and want to be notified if the column Line Variance is greater than five. That also needs to depend on other column values as well, such as the half being "1st half", Time Remaining being over 10, and the side being "Favorite". I'm having difficulty writing my if statement so that it searches for all these in the same row. I am using Twilio to notify me, and I am trying to include the event name, live line, line variance, team, and time remaining in the message of the row that is true. Does anyone know how I can do this?

if np.any(df['Line Variance'] <= 5) and np.any(df['Side'] == "Favorite"):
    # send message
        client.messages.create(to="+X", 
                       from_="+X", 
                       body= np.any(df['Line Variance']))
        print('message sent')
    

Data Picture

Aucun commentaire:

Enregistrer un commentaire