def setup(self) -> None: super().setup() self.shuffle_dim2_unstable = self.df_baseline.sort_values( dim_col(2), kind="quicksort").index.values self.shuffle_dim2_stable = self.df_baseline.sort_values( dim_col(2), kind="mergesort").index.values
def setup(self): super().setup() df_rle_wo_dims = self.df_rle.copy() for d in range(3): df_rle_wo_dims[dim_col(d)] = self.df_baseline[dim_col(d)].copy() self.df_rle_wo_dims = df_rle_wo_dims
def time_groupby2_sum_const12_rle(self): with self.ignore_performance_warnings(): self.df_rle_wo_dims.groupby(dim_col(2))[const_col([1, 2])].sum()
def time_groupby2_sum_const12_baseline(self): self.df_baseline.groupby(dim_col(2))[const_col([1, 2])].sum()
def time_key2_opsum_const12_baseline(self) -> None: self.df_baseline.groupby(dim_col(2))[const_col([1, 2])].sum()
def test_dim_value_counts(self, df: pd.DataFrame, d: int) -> None: assert (df[dim_col(d)].value_counts() == SIZE**(N_DIMS - 1)).all()
def test_dim_nunique(self, df: pd.DataFrame, d: int) -> None: assert df[dim_col(d)].nunique() == SIZE
def test_dim_col(d: int, expected: str) -> None: actual = dim_col(d) assert actual == expected
def test_dims_sorted(self, df: pd.DataFrame, d: int) -> None: delta = df[dim_col(d)].values[1:] - df[dim_col(d)].values[:-1] assert ((delta == 0) | (delta == 1) | (delta == -(SIZE - 1))).all()