109. Within-Group Z-Score

Hard

Return the age column of df, standardized to a z-score within each animal group: for each row, subtract that animal group's mean age and divide by that group's (sample) standard deviation. Return a Series aligned to the original index.

Sample data: df:

  animal  age  visits priority
a    cat  2.5       1      yes
b    cat  3.0       3      yes
c  snake  0.5       2       no
d    dog  NaN       3      yes
e    dog  5.0       2       no
f    cat  2.0       3       no
... (10 rows total)
Implement solve(...)