Esempio n. 1
0
    def test_dataframe_groupby_sort(self):
        def test_impl(df, param):
            return df.groupby('A', sort=param).min()

        hpat_func = self.jit(test_impl)

        n, m = 1000, 20
        np.random.seed(0)
        df = pd.DataFrame({
            'A': np.random.choice(np.arange(m), n),
            'B': np.arange(n, dtype=np.intp),
            'C': np.arange(n, dtype=np.float_),
            'D': gen_frand_array(n, nancount=n // 2),
        })

        for value in [True, False]:
            with self.subTest(sort=value):
                result = hpat_func(df, value) if value else hpat_func(
                    df, value).sort_index()
                result_ref = test_impl(df, value) if value else hpat_func(
                    df, value).sort_index()
                # TODO: implement index classes, as current indexes do not have names
                pd.testing.assert_frame_equal(result,
                                              result_ref,
                                              check_names=False)
Esempio n. 2
0
 def test_df_groupby_mean_by_float_sort_false(self):
     self._test_df_groupby_method('mean',
                                  usecase_name='by_float_mean',
                                  input_data=[gen_frand_array(n_groups_default)],
                                  groupby_params={'sort': 'False'})