Update, the version with combine
actually is faster. We were just working with a very small data frame. See below
actually_large_df = DataFrame(ID = rand(large_df.ID, 100_000), Count = rand(large_df.Count, 100_000));
@btime analysis_ID_better(actually_large_df);
2.476 ms (258 allocations: 2.54 MiB)
@btime analysis_ID(actually_large_df);
10.774 ms (136 allocations: 919.75 KiB)