I have a .csv file with the following columns
Concelho Classe
Lisbon A+
Porto C
Faro B-
Porto A+
Porto B-
Lisbon B-
Lisbon C
Lisbon A+
Lisbon A+
Lisbon A+
Lisbon B-
Lisbon D
Lisbon B-
Porto E
Porto E
Faro C
Faro B-
Faro C
And I would like to obtain a dataframe where I have grouped "concelho" and the number of occurrences of classes (B-, A, A+): such as...
Concelho count Class (B-,A, A+)
Lisbon 7
Porto 2
Faro 2
I tried to use groupby.count() or groupby.value_counts() from panda but I didn't manage to define the counting conditions (Classe = B- or A, or A+)