I have a large DataFrame with 500 columns out of which 300 columns col1, col2, ..col300 appears as follows:
idx col1 col2
a -1 4
b 2 1
c -1 -1
I want to get the following for the 300 columns. Other 200 columns are variables I am not interested in:
idx col1 col2 numPos
a -1 4 1
b 2 1 2
c -1 -1 0
where for each row I want to get the number of positive values. I don't want to use the apply method as there are about 2 million rows in the DataFrame. Is there a pythonic way to do this?