-1

Need help with pandas.

I have this dataframe:

a    b    c
Yes  No   Yes
Yes  Yes  No
Yes  No   No

How can I implement a Pandas code that will turn my dataframe to:

     a    b     c
Yes  3    1     1
No   0    2     2

I'm looking into using iloc and lambda but i'm really clueless. Is there a way for me to implement this?

0

1 Answer 1

0

This actually does the trick:

df.apply(pd.value_counts)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.