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

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation