a = np.array([[1.0, 2.0], [1.0, 3.0], [2.0, 5.0], [2.0, 6.0], [2.0, 8.0], [
    1.0, 4.0], [1.0, 1.0], [1.0, 3.5], [5.0, 8.0], [2.0, 1.0], [5.0, 9.0]])
df = pd.DataFrame(a, columns=['index', 'value'])
grouped = df.groupby('index')
result = grouped.aggregate(np.median)
print(result)
dealing with arrays: how to avoid a "for" statement