0

I'm new here and into programming ... I'm doing a small project and have a question.

How can I count the number of entries in a single row / column? As you can see in the photo, Female --> 1; female, female --> 2 etc.

enter image description here

Tomer Shetah
  • 8,413
  • 7
  • 27
  • 35
gio.s
  • 51
  • 7
  • Please edit your question to include a portion of the data itself in the question. See [this post](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) for how. – noah Dec 08 '20 at 19:20
  • Hello and welcome to SO! Please read [What should I do when someone answers my question?](https://stackoverflow.com/help/someone-answers) – Tomer Shetah Dec 09 '20 at 21:10

1 Answers1

0

Using pandas.Series.str.count:

df_cf["count"] = df_cf["borrower_genders"].str.count("female")
noah
  • 2,616
  • 13
  • 27
  • If this solves your problem consider [accepting](https://stackoverflow.com/help/someone-answers) the answer to help others in the future find the help they need. – noah Dec 08 '20 at 21:45