I am using the following code to get the average age of people whose salary is greater than some threshold.
dataframe.filter(df['salary'] > 100000).agg({"avg": "age"})
the column age is numeric (float) but still I am getting this error.
py4j.protocol.Py4JJavaError: An error occurred while calling o86.agg.
: scala.MatchError: age (of class java.lang.String)
Do you know any other way to obtain the avg etc. without using groupBy
function and SQL queries.