Skip to content

Commit

Permalink
TEST-modin-project#2686: add inplace parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
  • Loading branch information
anmyachev committed Feb 4, 2021
1 parent 5b718a3 commit 8cc85bb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions asv_bench/benchmarks/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,19 @@ def time_sort_values(self, shape, columns_number, ascending_list):


class TimeFillna:
param_names = ["shape", "limit"]
params = [UNARY_OP_DATA_SIZE[ASV_DATASET_SIZE], [None, 0.8]]
param_names = ["shape", "limit", "inplace"]
params = [UNARY_OP_DATA_SIZE[ASV_DATASET_SIZE], [None, 0.8], [False, True]]

def setup(self, shape, limit):
def setup(self, shape, limit, inplace):
pd = IMPL[ASV_USE_IMPL]
columns = [f"col{x}" for x in range(shape[1])]
self.df = pd.DataFrame(np.nan, index=pd.RangeIndex(shape[0]), columns=columns)
self.limit = int(limit * shape[0]) if limit else None

def time_fillna(self, shape, limit):
execute(self.df.fillna(0, limit=self.limit))
def time_fillna(self, shape, limit, inplace):
kw = {"value": 0.0, "limit": self.limit, "inplace": inplace}
if inplace:
self.df.fillna(**kw)
execute(self.df)
else:
execute(self.df.fillna(**kw))

0 comments on commit 8cc85bb

Please sign in to comment.