-2

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.

1
  • Removing pandas tag as it is irrelevant here. Commented Mar 24, 2021 at 17:15

1 Answer 1

1

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] 
Sign up to request clarification or add additional context in comments.

1 Comment

Ok ! Thank. It works

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.