-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?

pancakes
  • 159
  • 1
  • 2
  • 14

1 Answers1

0

This actually does the trick:

df.apply(pd.value_counts)
pancakes
  • 159
  • 1
  • 2
  • 14