I have a data frame and I want to create a new column name "new" based on a condition on a different column "col". Create the new column name "new" and count it whenever it finds any value in "col".
index col
1 2.11.67
2 NaN
3 NaN
4 5.10.56
5 NaN
6 2.10.67
7 NaN
8 2.09.67
should result in:-
index col new
1 2.11.67 1
2 NaN NaN
3 NaN NaN
4 5.10.56 2
5 NaN NaN
6 2.10.67 3
7 NaN NaN
8 2.09.67 4