我试图按多列分组,按计数对它们进行排名,并获得每组的最高记录。然而,当我调用groupby时,我得到了以下错误。
df.groupby("_c21","y2_co","y2_r","y2_z","y2_org").count()\
.show(n=10)
我尝试过按不为空的单列分组
df.groupby("_c21").count()\
.show(n=10)
AttributeError:“NoneType”对象没有属性“groupby”
样本行
+--------------------+--------------------+--------------------+-----+----+-----+--------------------+
| _c17| _c21| m|y2_co|y2_r| y2_z| y2_org|
+--------------------+--------------------+--------------------+-----+----+-----+--------------------+
|proc=;app=;cl=442...|tHO$SZPbABVo3A1X8...|[proc -> , app ->...| BR| PB|58397|Voax Provedor de ...|
|proc=;app=;cl=444...|tHO$SZPbABVo3A1X8...|[proc -> , app ->...| BR| PB|58397|Voax Provedor de ...|
|proc=;app=;cl=145...|Zu6zZxiekXnHfpNER...|[proc -> , app ->...| MX| NLE|66490| Totalplay|
|proc=;app=;cl=145...|Zu6zZxiekXnHfpNER...|[proc -> , app ->...| MX| NLE|66490| Totalplay|
|proc=;app=;cl=147...|Zu6zZxiekXnHfpNER...|[proc -> , app ->...| MX| NLE|66490| Totalplay|
+--------------------+--------------------+--------------------+-----+----+-----+--------------------+