I try to create a max column with this code. The sum column works
sum:
for col in list_names:
for month in [3,6,9,12]:
companies = companies.withColumn(col + 'sum_'+ str(month) + '_months', sum(companies[col + ult_pats2[month_ix - ix]] for ix in range(month)) )
max:
for col in list_names:
for month in [3,6,9,12]:
companies = companies.withColumn(col + 'max_'+ str(month) + '_months', max(companies[col + ult_pats2[month_ix - ix]] for ix in range(month)) )
the error message is:
"ValueError: Cannot convert column into bool: please use '&' for 'and', '|' for 'or', '~' for 'not' when building DataFrame boolean expressions"