New median function

I added the median function to stats.py