In Pandas I can ran df_raw_node["delta"] = df_raw_node.sort_values(["date", "hour", "node"])["snr_avg_up"].diff(1)for getting a new column with previous value of this group.
I tried the same with pyspark.
df_spark_joined = (df_spark.join(F.broadcast(df_spark_cm2plot),
df_spark.cm_mac==df_spark_cm2plot.cpe,
"right")
.where(F.col("cmts_id").rlike(stations))
.sort(["date", "hour"])
.groupby(["date", "hour", "node"])
.diff(1)
But here I'm getting an error 'GroupedData' object has no attribute 'diff'.
Is there another way to do it easily, as in pandas?
As it is spark on a BigData cluster I can't provide a MWE and am therefore grateful for any idea and do not expect a fully coded solution