pub fn median_py(data: &Bound<'_, PyArray1<f64>>) -> PyResult<f64>
Calculate median using optimized partial sort (O(n) instead of O(n log n))