Lucas Zago
04/24/2023, 11:35 PMtransform
, it returns that "it not possible to groupBy with .transform method"
Here is my code:
def qtd_faturada(col1,col2):
return (sum(when(col1=='S',col2))
.otherwise(-col2))
def with_qtd_faturada(df,col1,col2):
return df.withColumn("qtd_faturada",with_qtd_faturada(col(col1),col(col2)))
df=(df
.select(A,B,C)
.groupBy(C)
.transform(with_qtd_faturada,col1="A",col2="B"))
Am I missing something ?
Some advice would be really appreciated, 🙂JosephK (exDatabricks)
04/24/2023, 11:37 PMLucas Zago
04/24/2023, 11:39 PMJosephK (exDatabricks)
04/24/2023, 11:39 PMLucas Zago
04/24/2023, 11:41 PM