def test_prediction_methods_respect_index(self, data_pred2): x = data_pred2[['x1', 'x2']].ix[:3].sort_index(ascending=False) expected_index = pd.Index(np.array([3, 2, 1, 0])) cph = CoxPHFitter() cph.fit(data_pred2, duration_col='t', event_col='E') npt.assert_array_equal(cph.predict_partial_hazard(x).index, expected_index) npt.assert_array_equal(cph.predict_percentile(x).index, expected_index) npt.assert_array_equal(cph.predict(x).index, expected_index) npt.assert_array_equal(cph.predict_expectation(x).index, expected_index) aaf = AalenAdditiveFitter() aaf.fit(data_pred2, duration_col='t', event_col='E') npt.assert_array_equal(aaf.predict_percentile(x).index, expected_index) npt.assert_array_equal(aaf.predict(x).index, expected_index) npt.assert_array_equal(aaf.predict_expectation(x).index, expected_index)