Код: Выделить всё
A B C CLASS
-----------------------
al1 bal1 cal1 Ship
al1 bal1 cal1 Ship
al1 bal2 cal2 Ship
al2 bal2 cal2 Cow
al3 bal3 cal3 Car
al1 bal2 cal3 Car
al3 bal3 cal3 Car
Код: Выделить всё
df_B = df_things.groupby('CLASS').B.value_counts()
Код: Выделить всё
CLASS B
-------------
ship bal1 2
bal2 1
cow bal2 2
car bal2 1
bal3 2
Код: Выделить всё
CLASS B
-------------
ship bal1 2
bal2 1
car bal2 1
bal3 2
Подробнее здесь: https://stackoverflow.com/questions/539 ... ture-value