Relative Content

Tag Archive for pythonpandasgrouping

Counting groups of like values within the same column

I have a dataframe containing columns with groups of 1’s and -1’s. Each column could contain any amount of 1’s or -1’s grouped together within each column, and they could also begin with an unspecified number of NaN’s. I would like to count the total of values within each group excluding the NaN’s.