In pandas, I can successfully run the following:
def car(t)
if t in df_a:
return df_a[t]/df_b[t]
else:
return 0
But how can I do the exact same thing with spark dataframe?Many thanks!
The data is like this
df_a
a 20
b 40
c 60
df_b
a 80
b 50
e 100
The result should be 0.25 when input car(a)