79690815

Date: 2025-07-05 05:37:51
Score: 1
Natty:
Report link

I think a combination of create_map from pyspark.sql.functions, chain from itertools and mapping might get you a more performant way.

This requires you are able to map your algorithm to a dict as per this SO answer: ttps://stackoverflow.com/a/42983199/2186184

Since you have multiple conditions you might need nested dicts, not sure if that is allowed in create_map though.

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Jonathan