Error - ValueError: Cannot convert column into bool (Pyspark)

Getting an error on the if else statement below. Any ideas? My intention is not to print, but to trigger an email in python if > 5 Thx!!

df2 = df.select("pull_date","promo_amt") \
.groupby("pull_date") \
.agg(count("promo_amt").alias("Tots"),sum("promo_amt").alias("Sums")) \
.filter(df["pull_date"] == current_date()) \

if df2['Tots'] > 5:
   print(">5")
else:
   print("<=5")`


from Recent Questions - Stack Overflow https://ift.tt/3iUTg5a
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept