I have a bunch of data involving certain numbers for certain players of specific sports. I want to use pivot tables in Pandas to have it split up the data by sport, and for the corresponding value for each sport have the mean "number" value for all people who play that sport. (So if it were basketball, it would average the number of all the players who play basketball, and the number basically represents a preference.)
I can do this pretty easily with pivot tables, but if I wanted to do the same thing for calculating the standard deviation, I cannot figure out how. I can do np.mean
for the mean, but there's no np.std
. I know there's std()
but I'm unsure how I'd use it in this context.
Are pivot tables not advisable for doing this task? How should I find the standard deviation for the numeric data of all players of a specific sport?
What version of numpy are you using? 1.9.2 has np.std: