Function When + Dictionary.

weldermartins
Honored Contributor

Hey everyone, I'm avoiding repeating the When Function for 12x, so I thought of the dictionary. I don't know if it's a limitation of the Spark function or a Logic error. Does the function allow this concatenation?

image

weldermartins
Honored Contributor

@Werner Stinckens​,  @pat​, @Hubert Dudek​   Have you ever done something similar?

Tromen026
New Contributor II

I have read some good stuff here. Certainly price bookmarking for revisiting.

little caesars pizza prices

braums menu with prices

weldermartins
Honored Contributor

Hello everyone, I found this alternative to reduce repeated code.

custoDF = (custoDF.withColumn('month', col('Nummes').cast('string'))
        .replace(months, subset=['month']))

image

View solution in original post