How to properly use pandas groupby with apply function for side effects? (First group applied twice)
A follow up on this question, as of pandas version 0.25.0 released July 18, 2019 Groupby.apply
on a dataframe evaluates the first group only once. Upgrading to this version is probably the most straightforward approach to resolving this.
Release information here: https://pandas.pydata.org/pandas-docs/stable/whatsnew/v0.25.0.html