I have a table where similar to"
no type category a b c d
1 plan avg 5 4 3
2 plan avg 3 3
3 plan est 2 1 2
4 plan est 6 4
5 forecast avg 4 3
I want to create a new column where it will count number of columns that have value in the 4 last columns.
no type category counts
1 plan avg 3
2 plan avg 2
3 plan est 3
4 plan est 2
5 forecast avg 2
How can I do that in python?
Thanks in advance.
count()method directly for the dataframe. Thecount()method returns the number of non-NaN values in each column.