def test_series_sort_values_ignore_index(ignore_index): gsr = Series([1, 3, 5, 2, 4]) psr = gsr.to_pandas() expect = psr.sort_values(ignore_index=ignore_index) got = gsr.sort_values(ignore_index=ignore_index) assert_eq(expect, got)
def test_series_sort_index(nelem, asc): np.random.seed(0) sr = Series((100 * np.random.random(nelem))) orig = sr.to_array() got = sr.sort_values().sort_index(ascending=asc).to_array() if not asc: # Reverse the array for descending sort got = got[::-1] np.testing.assert_array_equal(orig, got)
def get_median(self, col: cudf.Series): col = col.dropna().reset_index(drop=True) return col.sort_values()[len(col)//2]