如何根据另一列中的一个列中计数两个唯一值?
如果有人能为此提供帮助,将不胜感激。我正在尝试将两个新变量添加到
我现有的df( *grade1sum和 *grade2sum)求和每个电影的等级(ET的分级三倍,因此 *级别的总数始终等于3),例如,
只有两个等级(1和2)。希望这是有道理的,因此,如果有人能提供帮助,将不胜感激(我想将它们添加到现有的DF中,因此目前我只有前三列)。
**其他人是否知道如何计算每部电影收到的每个年级的次数?
If anyone could help with this would be appreciated. I am trying to add two new variables to
my existing DF (*Grade1Sum and *Grade2Sum) summing each film's grade (ET got graded one three times so the *Grade1Sum total is always equal to 3 for example)
There are only two grades (1 and 2). Hopefully this makes sense, so if anyone can help, would be appreciated (I want to add them to an existing DF, thus currently I only have the first three columns).
I am adding what I want the DF to look like as a pic as it won't format correctly:
**Additional does anyone know how to count the amount of times each grade was received per film?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一种做到这一点的方法,
这是一种更灵活的方法
Here is one way to do it
Here is a more flexible way to do it