我无法使用 agg 获得多个指标,如下所示。
table.select("date_time")\ .withColumn("date",to_timestamp("date_time"))\ .agg({'date_time':'max', 'date_time':'min'}).show()
我看到第二个聚合覆盖了第一个聚合,有人可以帮助我在同一列上获得多个聚合吗?
我无法复制并确保它有效,但我建议不要使用 adict来进行聚合,试试这样:
dict
table.select("date_time")\ .withColumn("date",to_timestamp("date_time"))\ .agg(min('date_time'), max('date_time')).show()
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
点击生成二维码
我来说两句