Skip to content

Commit 0cae716

Browse files
BENCH: add DataFrame.reindex(columns=..) benchmark that selects existing columns (#40247)
1 parent bf270f6 commit 0cae716

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

asv_bench/benchmarks/frame_methods.py

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def setup(self):
5252
N = 10 ** 3
5353
self.df = DataFrame(np.random.randn(N * 10, N))
5454
self.idx = np.arange(4 * N, 7 * N)
55+
self.idx_cols = np.random.randint(0, N, N)
5556
self.df2 = DataFrame(
5657
{
5758
c: {
@@ -68,6 +69,9 @@ def time_reindex_axis0(self):
6869
self.df.reindex(self.idx)
6970

7071
def time_reindex_axis1(self):
72+
self.df.reindex(columns=self.idx_cols)
73+
74+
def time_reindex_axis1_missing(self):
7175
self.df.reindex(columns=self.idx)
7276

7377
def time_reindex_both_axes(self):

0 commit comments

Comments
 (0)