From ec686bcb4250bb6f65282b3a2734ca9c58a86252 Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Tue, 9 Feb 2021 16:17:31 +0300 Subject: [PATCH] TEST-#2690: add case with one column Signed-off-by: Anatoly Myachev --- asv_bench/benchmarks/benchmarks.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/asv_bench/benchmarks/benchmarks.py b/asv_bench/benchmarks/benchmarks.py index a744e24e8f1..8df8db3a68b 100644 --- a/asv_bench/benchmarks/benchmarks.py +++ b/asv_bench/benchmarks/benchmarks.py @@ -490,14 +490,21 @@ def time_value_counts(self, shape, bins): class TimeAstype: - param_names = ["shape", "dtype"] + param_names = ["shape", "dtype", "astype_ncolumns"] params = [ UNARY_OP_DATA_SIZE[ASV_DATASET_SIZE], ["float64", "category"], + ["one", "all"], ] - def setup(self, shape, dtype): + def setup(self, shape, dtype, astype_ncolumns): self.df = generate_dataframe(ASV_USE_IMPL, "int", *shape, RAND_LOW, RAND_HIGH) + if astype_ncolumns == "all": + self.astype_arg = dtype + elif astype_ncolumns == "one": + self.astype_arg = {"col1": dtype} + else: + raise ValueError("astype_ncolumns: {astype_ncolumns} isn't supported") - def time_astype(self, shape, dtype): - execute(self.df.astype(dtype)) + def time_astype(self, shape, dtype, astype_ncolumns): + execute(self.df.astype(self.astype_arg))