Skip to content

Commit 119c2e1

Browse files
committed
TST: add vb_suite test for reindex with upcasting
1 parent 8ad9598 commit 119c2e1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

vb_suite/frame_methods.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@
5454
frame_reindex_both_axes_ix = Benchmark('df.ix[idx, idx]', setup,
5555
start_date=datetime(2011, 1, 1))
5656

57+
#----------------------------------------------------------------------
58+
# reindex with upcasts
59+
setup = common_setup + """
60+
df=DataFrame(dict([(c, {
61+
0: randint(0, 2, 1000).astype(np.bool_),
62+
1: randint(0, 1000, 1000).astype(np.int16),
63+
2: randint(0, 1000, 1000).astype(np.int32),
64+
3: randint(0, 1000, 1000).astype(np.int64)
65+
}[randint(0, 4)]) for c in range(1000)]))
66+
"""
67+
68+
frame_reindex_upcast = Benchmark('df.reindex(permutation(range(1200)))', setup)
69+
5770
#----------------------------------------------------------------------
5871
# boolean indexing
5972

@@ -71,6 +84,7 @@
7184

7285
setup = common_setup + """
7386
df = DataFrame(randn(10000, 100))
87+
7488
def f():
7589
if hasattr(df, '_item_cache'):
7690
df._item_cache.clear()

vb_suite/pandas_vb_common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from pandas.util.testing import rands
33
from datetime import timedelta
44
from numpy.random import randn
5+
from numpy.random import randint
6+
from numpy.random import permutation
57
import pandas.util.testing as tm
68
import random
79
import numpy as np

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy