Skip to content

Commit 7e837ee

Browse files
committed
CI: Run ASV on Travis for failed benchmarks
create asv.sh add to travis Changed file permission Add else statement and asv machine config move to separate travis build CI: Run ASV on Travis for failed benchmarks create asv.sh add to travis move to separate travis build Change build order and change to asv dev Put asv before doc Fix some failing benchmarks Grep for failed benchmarks Add travis wait Don't grep output yet Remove travis_wait for now fix some benchmarks Now grep output add travis wait 40 to ci/asv.sh Add tee Remove wait Start catching warnings catch more warnings Fix ci strategy
1 parent 69cd5fb commit 7e837ee

21 files changed

+169
-40
lines changed

.travis.yml

+8
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ matrix:
7373
env:
7474
- JOB="3.6_NUMPY_DEV" TEST_ARGS="--skip-slow --skip-network" PANDAS_TESTING_MODE="deprecate"
7575
# In allow_failures
76+
- dist: trusty
77+
env:
78+
- JOB="3.6_ASV" ASV=true
79+
# In allow_failures
7680
- dist: trusty
7781
env:
7882
- JOB="3.6_DOC" DOC=true
@@ -93,6 +97,9 @@ matrix:
9397
- dist: trusty
9498
env:
9599
- JOB="3.6_NUMPY_DEV" TEST_ARGS="--skip-slow --skip-network" PANDAS_TESTING_MODE="deprecate"
100+
- dist: trusty
101+
env:
102+
- JOB="3.6_ASV" ASV=true
96103
- dist: trusty
97104
env:
98105
- JOB="3.6_DOC" DOC=true
@@ -128,6 +135,7 @@ script:
128135
- ci/script_single.sh
129136
- ci/script_multi.sh
130137
- ci/lint.sh
138+
- ci/asv.sh
131139
- echo "checking imports"
132140
- source activate pandas && python ci/check_imports.py
133141
- echo "script done"

asv_bench/benchmarks/algorithms.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from importlib import import_module
23

34
import numpy as np
@@ -83,7 +84,8 @@ def setup(self):
8384
self.all = self.uniques.repeat(10)
8485

8586
def time_match_string(self):
86-
pd.match(self.all, self.uniques)
87+
with warnings.catch_warnings(record=True):
88+
pd.match(self.all, self.uniques)
8789

8890

8991
class Hashing(object):

asv_bench/benchmarks/categoricals.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
import numpy as np
24
import pandas as pd
35
import pandas.util.testing as tm
@@ -119,11 +121,15 @@ def setup(self):
119121

120122
self.s_str = pd.Series(tm.makeCategoricalIndex(N, ncats)).astype(str)
121123
self.s_str_cat = self.s_str.astype('category')
122-
self.s_str_cat_ordered = self.s_str.astype('category', ordered=True)
124+
with warnings.catch_warnings(record=True):
125+
self.s_str_cat_ordered = self.s_str.astype('category',
126+
ordered=True)
123127

124128
self.s_int = pd.Series(np.random.randint(0, ncats, size=N))
125129
self.s_int_cat = self.s_int.astype('category')
126-
self.s_int_cat_ordered = self.s_int.astype('category', ordered=True)
130+
with warnings.catch_warnings(record=True):
131+
self.s_int_cat_ordered = self.s_int.astype('category',
132+
ordered=True)
127133

128134
def time_rank_string(self):
129135
self.s_str.rank()

asv_bench/benchmarks/frame_methods.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import string
2+
import warnings
3+
24
import numpy as np
35
import pandas.util.testing as tm
46
from pandas import (DataFrame, Series, MultiIndex, date_range, period_range,
@@ -15,7 +17,8 @@ def setup(self):
1517
self.df = DataFrame(np.random.randn(10000, 25))
1618
self.df['foo'] = 'bar'
1719
self.df['bar'] = 'baz'
18-
self.df = self.df.consolidate()
20+
with warnings.catch_warnings(record=True):
21+
self.df = self.df.consolidate()
1922

2023
def time_frame_get_numeric_data(self):
2124
self.df._get_numeric_data()
@@ -141,8 +144,8 @@ class Repr(object):
141144
def setup(self):
142145
nrows = 10000
143146
data = np.random.randn(nrows, 10)
144-
idx = MultiIndex.from_arrays(np.tile(np.random.randn(3, nrows / 100),
145-
100))
147+
arrays = np.tile(np.random.randn(3, int(nrows / 100)), 100)
148+
idx = MultiIndex.from_arrays(arrays)
146149
self.df3 = DataFrame(data, index=idx)
147150
self.df4 = DataFrame(data, index=np.random.randn(nrows))
148151
self.df_tall = DataFrame(np.random.randn(nrows, 10))

asv_bench/benchmarks/groupby.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from string import ascii_letters
23
from itertools import product
34
from functools import partial
@@ -340,7 +341,8 @@ def time_dt_size(self):
340341
self.df.groupby(['dates']).size()
341342

342343
def time_dt_timegrouper_size(self):
343-
self.df.groupby(TimeGrouper(key='dates', freq='M')).size()
344+
with warnings.catch_warnings(record=True):
345+
self.df.groupby(TimeGrouper(key='dates', freq='M')).size()
344346

345347
def time_category_size(self):
346348
self.draws.groupby(self.cats).size()
@@ -467,7 +469,7 @@ class SumMultiLevel(object):
467469

468470
def setup(self):
469471
N = 50
470-
self.df = DataFrame({'A': range(N) * 2,
472+
self.df = DataFrame({'A': list(range(N)) * 2,
471473
'B': range(N * 2),
472474
'C': 1}).set_index(['A', 'B'])
473475

asv_bench/benchmarks/indexing.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
import numpy as np
24
import pandas.util.testing as tm
35
from pandas import (Series, DataFrame, MultiIndex, Int64Index, Float64Index,
@@ -91,7 +93,8 @@ def time_getitem_pos_slice(self, index):
9193
self.s[:80000]
9294

9395
def time_get_value(self, index):
94-
self.s.get_value(self.lbl)
96+
with warnings.catch_warnings(record=True):
97+
self.s.get_value(self.lbl)
9598

9699
def time_getitem_scalar(self, index):
97100
self.s[self.lbl]
@@ -112,7 +115,8 @@ def setup(self):
112115
self.bool_obj_indexer = self.bool_indexer.astype(object)
113116

114117
def time_get_value(self):
115-
self.df.get_value(self.idx_scalar, self.col_scalar)
118+
with warnings.catch_warnings(record=True):
119+
self.df.get_value(self.idx_scalar, self.col_scalar)
116120

117121
def time_ix(self):
118122
self.df.ix[self.idx_scalar, self.col_scalar]
@@ -231,11 +235,13 @@ class PanelIndexing(object):
231235
goal_time = 0.2
232236

233237
def setup(self):
234-
self.p = Panel(np.random.randn(100, 100, 100))
235-
self.inds = range(0, 100, 10)
238+
with warnings.catch_warnings(record=True):
239+
self.p = Panel(np.random.randn(100, 100, 100))
240+
self.inds = range(0, 100, 10)
236241

237242
def time_subset(self):
238-
self.p.ix[(self.inds, self.inds, self.inds)]
243+
with warnings.catch_warnings(record=True):
244+
self.p.ix[(self.inds, self.inds, self.inds)]
239245

240246

241247
class MethodLookup(object):
@@ -295,7 +301,8 @@ def setup(self):
295301
def time_insert(self):
296302
np.random.seed(1234)
297303
for i in range(100):
298-
self.df.insert(0, i, np.random.randn(self.N))
304+
self.df.insert(0, i, np.random.randn(self.N),
305+
allow_duplicates=True)
299306

300307
def time_assign_with_setitem(self):
301308
np.random.seed(1234)

asv_bench/benchmarks/io/hdf.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
import numpy as np
24
from pandas import DataFrame, Panel, date_range, HDFStore, read_hdf
35
import pandas.util.testing as tm
@@ -105,10 +107,11 @@ class HDFStorePanel(BaseIO):
105107

106108
def setup(self):
107109
self.fname = '__test__.h5'
108-
self.p = Panel(np.random.randn(20, 1000, 25),
109-
items=['Item%03d' % i for i in range(20)],
110-
major_axis=date_range('1/1/2000', periods=1000),
111-
minor_axis=['E%03d' % i for i in range(25)])
110+
with warnings.catch_warnings(record=True):
111+
self.p = Panel(np.random.randn(20, 1000, 25),
112+
items=['Item%03d' % i for i in range(20)],
113+
major_axis=date_range('1/1/2000', periods=1000),
114+
minor_axis=['E%03d' % i for i in range(25)])
112115
self.store = HDFStore(self.fname)
113116
self.store.append('p1', self.p)
114117

asv_bench/benchmarks/join_merge.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
import string
23

34
import numpy as np
@@ -26,7 +27,8 @@ def setup(self):
2627
self.mdf1['obj2'] = 'bar'
2728
self.mdf1['int1'] = 5
2829
try:
29-
self.mdf1.consolidate(inplace=True)
30+
with warnings.catch_warnings(record=True):
31+
self.mdf1.consolidate(inplace=True)
3032
except:
3133
pass
3234
self.mdf2 = self.mdf1.copy()
@@ -75,10 +77,15 @@ class ConcatPanels(object):
7577
param_names = ['axis', 'ignore_index']
7678

7779
def setup(self, axis, ignore_index):
78-
panel_c = Panel(np.zeros((10000, 200, 2), dtype=np.float32, order='C'))
79-
self.panels_c = [panel_c] * 20
80-
panel_f = Panel(np.zeros((10000, 200, 2), dtype=np.float32, order='F'))
81-
self.panels_f = [panel_f] * 20
80+
with warnings.catch_warnings(record=True):
81+
panel_c = Panel(np.zeros((10000, 200, 2),
82+
dtype=np.float32,
83+
order='C'))
84+
self.panels_c = [panel_c] * 20
85+
panel_f = Panel(np.zeros((10000, 200, 2),
86+
dtype=np.float32,
87+
order='F'))
88+
self.panels_f = [panel_f] * 20
8289

8390
def time_c_ordered(self, axis, ignore_index):
8491
concat(self.panels_c, axis=axis, ignore_index=ignore_index)

asv_bench/benchmarks/offset.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
import warnings
23
from datetime import datetime
34

45
import numpy as np
@@ -76,7 +77,8 @@ def setup(self, offset):
7677
self.data = pd.Series(rng)
7778

7879
def time_add_offset(self, offset):
79-
self.data + offset
80+
with warnings.catch_warnings(record=True):
81+
self.data + offset
8082

8183

8284
class OffsetDatetimeIndexArithmetic(object):
@@ -90,7 +92,8 @@ def setup(self, offset):
9092
self.data = pd.date_range(start='1/1/2000', periods=N, freq='T')
9193

9294
def time_add_offset(self, offset):
93-
self.data + offset
95+
with warnings.catch_warnings(record=True):
96+
self.data + offset
9497

9598

9699
class OffestDatetimeArithmetic(object):

asv_bench/benchmarks/panel_ctor.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from datetime import datetime, timedelta
23

34
from pandas import DataFrame, DatetimeIndex, date_range
@@ -19,7 +20,8 @@ def setup(self):
1920
self.data_frames[x] = df
2021

2122
def time_from_dict(self):
22-
Panel.from_dict(self.data_frames)
23+
with warnings.catch_warnings(record=True):
24+
Panel.from_dict(self.data_frames)
2325

2426

2527
class SameIndexes(object):
@@ -34,7 +36,8 @@ def setup(self):
3436
self.data_frames = dict(enumerate([df] * 100))
3537

3638
def time_from_dict(self):
37-
Panel.from_dict(self.data_frames)
39+
with warnings.catch_warnings(record=True):
40+
Panel.from_dict(self.data_frames)
3841

3942

4043
class TwoIndexes(object):
@@ -53,4 +56,5 @@ def setup(self):
5356
self.data_frames = dict(enumerate(dfs))
5457

5558
def time_from_dict(self):
56-
Panel.from_dict(self.data_frames)
59+
with warnings.catch_warnings(record=True):
60+
Panel.from_dict(self.data_frames)

asv_bench/benchmarks/panel_methods.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
import numpy as np
24

35
from .pandas_vb_common import Panel, setup # noqa
@@ -10,10 +12,13 @@ class PanelMethods(object):
1012
param_names = ['axis']
1113

1214
def setup(self, axis):
13-
self.panel = Panel(np.random.randn(100, 1000, 100))
15+
with warnings.catch_warnings(record=True):
16+
self.panel = Panel(np.random.randn(100, 1000, 100))
1417

1518
def time_pct_change(self, axis):
16-
self.panel.pct_change(1, axis=axis)
19+
with warnings.catch_warnings(record=True):
20+
self.panel.pct_change(1, axis=axis)
1721

1822
def time_shift(self, axis):
19-
self.panel.shift(1, axis=axis)
23+
with warnings.catch_warnings(record=True):
24+
self.panel.shift(1, axis=axis)

asv_bench/benchmarks/reindex.py

-4
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ def setup(self):
167167
col_array2 = col_array.copy()
168168
col_array2[:, :10000] = np.nan
169169
self.col_array_list = list(col_array)
170-
self.col_array_list2 = list(col_array2)
171170

172171
def time_lib_fast_zip(self):
173172
lib.fast_zip(self.col_array_list)
174-
175-
def time_lib_fast_zip_fillna(self):
176-
lib.fast_zip_fillna(self.col_array_list2)

asv_bench/benchmarks/reshape.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ def setup(self):
104104
self.letters = list('ABCD')
105105
yrvars = [l + str(num)
106106
for l, num in product(self.letters, range(1, nyrs + 1))]
107-
107+
columns = [str(i) for i in range(nidvars)] + yrvars
108108
self.df = DataFrame(np.random.randn(N, nidvars + len(yrvars)),
109-
columns=list(range(nidvars)) + yrvars)
109+
columns=columns)
110110
self.df['id'] = self.df.index
111111

112112
def time_wide_to_long_big(self):

asv_bench/benchmarks/strings.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
import numpy as np
24
from pandas import Series
35
import pandas.util.testing as tm
@@ -23,7 +25,8 @@ def time_endswith(self):
2325
self.s.str.endswith('A')
2426

2527
def time_extract(self):
26-
self.s.str.extract('(\\w*)A(\\w*)')
28+
with warnings.catch_warnings(record=True):
29+
self.s.str.extract('(\\w*)A(\\w*)')
2730

2831
def time_findall(self):
2932
self.s.str.findall('[A-Z]+')

asv_bench/benchmarks/timeseries.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from datetime import timedelta
23

34
import numpy as np
@@ -74,7 +75,8 @@ def setup(self):
7475
freq='S'))
7576

7677
def time_infer_dst(self):
77-
self.index.tz_localize('US/Eastern', infer_dst=True)
78+
with warnings.catch_warnings(record=True):
79+
self.index.tz_localize('US/Eastern', infer_dst=True)
7880

7981

8082
class ResetIndex(object):
@@ -365,7 +367,7 @@ class ToDatetimeCache(object):
365367

366368
def setup(self, cache):
367369
N = 10000
368-
self.unique_numeric_seconds = range(N)
370+
self.unique_numeric_seconds = list(range(N))
369371
self.dup_numeric_seconds = [1000] * N
370372
self.dup_string_dates = ['2000-02-11'] * N
371373
self.dup_string_with_tz = ['2000-02-11 15:00:00-0800'] * N

0 commit comments

Comments
 (0)