Premium problem30. Patch Negatives with Group Mean

Hard Locked

Build df with vals = np.random.RandomState(seed).randint(-30, 30, size=15) and grps = np.random.RandomState(seed).choice(['A','B'], 15). Return a Series replacing each negative value in 'vals' with the mean of the non-negative values in its group.

Input

31

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)