Skip to content
Advertisement

How to pass a variable into an Pyspark sequence to generate time series?

I want to generate a time series, from 2021-12-01 to 2021-12-31, but I want to pass the values with variables into de function secuence.

This is my code:

JavaScript

I want the values 2021-12-01 and 2021-12-31 inside variables.

Something like:

JavaScript

And get this result:

JavaScript

But instead I’m reciving:

cannot resolve ‘eldia1‘ given input columns: [MES, NEGOCIO];

Advertisement

Answer

Easiest would be to use Python string formatting to add the variable content to your sql expression.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement