[Tutor] Count Within a G on

Leam Hall leamhall at gmail.com
Thu May 19 14:19:03 EDT 2022


What code have you tried so far?

On Thu, May 19, 2022, 12:57 PM Robert Wilcox <rjwilcox at gmail.com> wrote:

> Cheers,
> I have a dataframe of IDs that has a specific order. I need a rolling count
> of IDs for each ID.
> Below my example has 2 IDs with 2 other data fields in order. The Count
> field is what I need to add to the dataframe:
> ID       Value_1        Value_2     Count
> 1234    x                    a                1
> 1234    x                    b                2
> 1234    y                    c                3
> 2222    s                    a                1
> 2222    t                     b                2
>
> Thanks,
> Bob
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list