That is what I have:
In: u = np.random.choice(['Male','Female'], len(null_Gender), p = P_Gender)
In: Counter(u)
Out: Counter({'Female': 115730, 'Male': 357627})
I would like to extract the count values, without writing them manually.
That is what I have:
In: u = np.random.choice(['Male','Female'], len(null_Gender), p = P_Gender)
In: Counter(u)
Out: Counter({'Female': 115730, 'Male': 357627})
I would like to extract the count values, without writing them manually.
collections.Counter
is a subclass of dict
, so you can just call values
from collections import Counter
c = Counter({'Female': 115730, 'Male': 357627})
print(list(c.values()))
>>> [357627, 115730]