更新时间:2022-12-10 21:20:13
try:
try:
df['group'].value_counts()['a']
切勿在熊猫中使用循环。它效率低下,通常会重新创建包中的某些现有功能。
in general, you should NEVER use for loops in pandas. it's inefficient and usually recreating some existing functionality in the package.
如何在python pandas的同一列上进行分组并取唯一计数和某个值计数作为聚合?
python pandas:如何根据列中的每个值进行分组并计数?
Pandas:根据另一列中的值对两列进行分组