[英]pyspark dataframe count of where clause value is equals to
following is the sample dataframe以下是样本 dataframe
I have one column in with 'id' and i need new dataframe with count number considering where clause where vaule is equal to "number", new dataframe with vaule and count我有一个带有“id”的列,我需要新的 dataframe 和计数,考虑到 where 子句,其中 vaule 等于“数字”,新的 dataframe 和 vaule 和计数
source df and required newdf with count of df源 df 和需要的 newdf 以及 df 的计数
Any suggestions:有什么建议么:
Just group by and count:只需分组并计数:
newdf = df.groupBy('Id').count()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.