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
17 changes: 17 additions & 0 deletions asv_bench/benchmarks/categoricals.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,13 @@ class Indexing:
def setup(self):
N = 10 ** 5
self.index = pd.CategoricalIndex(range(N), range(N))
self.index_non_overlapping = pd.CategoricalIndex(range(N + 1), range(N + 1))
self.series = pd.Series(range(N), index=self.index).sort_index()
self.category = self.index[500]
self.df = pd.DataFrame(range(N), columns=["a"], index=self.index)
self.df_non_overlapping = pd.DataFrame(
range(N + 1), columns=["a"], index=self.index_non_overlapping
)

def time_get_loc(self):
self.index.get_loc(self.category)
Expand All @@ -326,6 +331,18 @@ def time_reindex_missing(self):
def time_sort_values(self):
self.index.sort_values(ascending=False)

def time_append_index(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you put these with the append/concat ones instead

self.index.append(self.index)

def time_append_non_overlapping_index(self):
self.index.append(self.index_non_overlapping)

def time_concat_with_index(self):
pd.concat([self.df, self.df])

def time_concat_with_non_overlapping_index(self):
pd.concat([self.df, self.df_non_overlapping])


class SearchSorted:
def setup(self):
Expand Down