I am trying to get the count of 1s at the tail of a pandas dataframe. From this dataframe:
x
1
2
3
1
1
1
I want to get the count of 3. If there are no 1s in the tail, then the function should return 0. I could not find any function of pandas to do this. Any ideas?