Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add asv
  • Loading branch information
jbrockmendel committed Aug 23, 2019
commit d74e5a84d6d30c02c114d8f2e58d4e53153348f8
17 changes: 17 additions & 0 deletions asv_bench/benchmarks/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ def time_replace_series(self, inplace):
self.s.replace(self.to_rep, inplace=inplace)


class ReplaceList:
# GH#28099

params = [True, False]
param_names = ["inplace"]

def setup_cache(self):
self.df = pd.DataFrame({"A": 0, "B": 0}, index=range(4 * 10 ** 7))

def time_replace_list(self, inplace):
self.df.replace([np.inf, -np.inf], np.nan, inplace=inplace)

def time_replace_list_one_match(self, inplace):
# the 1 can be held in self._df.blocks[0], while the inf and -inf cant
self.df.replace([np.inf, -np.inf, 1], np.nan, inplace=inplace)


class Convert:

params = (["DataFrame", "Series"], ["Timestamp", "Timedelta"])
Expand Down