I am trying to count how many values I have in a dataframe row subsection. Values are actually strings, so even counting 1 or -1 would not work. Hence I switched values to 'a', 'b' and 'c'. In example below:
COL1 COL2 COL3 COL4 'a' 'b' 'c' # last 3 columns abc would count occurences
a c b c
c a a b
c b c b
I am however only trying to count values per row in subsection COL3 and COL4.
I have looked at various answers at SO, including here. I also tried to include a subsection by the following:df1["a"] = df1[COL3:COL4], count(a)
Thank you for your suggestions.