def cells_number(rc):
    """
    Calculates number of cells in each frame.
    Intedend for use on 'cells' or subsets of 'cells' tables.
    """    
    return rc[['frame', 'cell_id']].groupby('frame').agg(len).reset_index().sort('frame')['cell_id'].values