How to count the number of categories present in a column of a DataFrame

Here is an example:
Starting with the following data
df = DataFrame(A = [“a”,“a”,“a”,“b”,“b”,“b”,“c”,“c”],
B = [“X”,“Y”,“Z”,“Y”,“Y”,“Z”,“X”,“X”],
C = [2,3,5,2,10,7,5,1])
I would like to count for each value of the A column the number of different values in column B, the result would be something like:
a 3
b 2
c 1
could be tuples, arrays, a dictionary…

Hope this is clearer!
Thanks for your attention.