Repository: pandas-dev/pandas

Issue:
TST: Broken asv performance test sparse.py
#### Code Sample, a copy-pastable example if possible

- asv version
```
[asv_bench] asv --version
asv 0.3.dev1126+2320b0f
```

- Input
```bash
# Your code here
asv continuous -f 1.1 origin/master HEAD -b sparse
```

- Output
```
· Creating environments
· Discovering benchmarks
·· Uninstalling from conda-py3.6-Cython-matplotlib-numexpr-numpy-openpyxl-pytables-pytest-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt..
·· Installing into conda-py3.6-Cython-matplotlib-numexpr-numpy-openpyxl-pytables-pytest-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt..
· Running 42 total benchmarks (2 commits * 1 environments * 21 benchmarks)
[  0.00%] · For pandas commit hash 8276a420:
[  0.00%] ·· Building for conda-py3.6-Cython-matplotlib-numexpr-numpy-openpyxl-pytables-pytest-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt....
[  0.00%] ·· Benchmarking conda-py3.6-Cython-matplotlib-numexpr-numpy-openpyxl-pytables-pytest-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt
[  2.38%] ··· Running reshape.unstack_sparse_keyspace.time_unstack_sparse_keyspace                                                                            1.88±0.06ms
[  4.76%] ··· Running sparse.sparse_arithmetic_block.time_sparse_addition                                                                                          failed
...
```

#### Problem description
Whole `pandas/asv_bench/benchmarks/sparse.py` tests fail.
It seems that `from itertools import repeat` conflicts with the `repeat` parameter for asv.

```python
[asv_bench] head benchmarks/sparse.py
from itertools import repeat

from .pandas_vb_common import *
import scipy.sparse
from pandas import SparseSeries, SparseDataFrame


class sparse_series_to_frame(object):
    goal_time = 0.2
```

#### Expected Output
After removing `from itertools import repeat`, it works well.

```python
[asv_bench] head benchmarks/sparse.py
import itertools

from .pandas_vb_common import *
import scipy.sparse
from pandas import SparseSeries, SparseDataFrame


class sparse_series_to_frame(object):
    goal_time = 0.2
```
```bash
[asv_bench] asv continuous -f 1.1 origin/master HEAD -b sparse
· Creating environments
· Discovering benchmarks
·· Uninstalling from conda-py3.6-Cython-matplotlib-numexpr-numpy-openpyxl-pytables-pytest-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt.
·· Installing into conda-py3.6-Cython-matplotlib-numexpr-numpy-openpyxl-pytables-pytest-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt...
· Running 42 total benchmarks (2 commits * 1 environments * 21 benchmarks)
[  0.00%] · For pandas commit hash 965c1c89:
[  0.00%] ·· Building for conda-py3.6-Cython-matplotlib-numexpr-numpy-openpyxl-pytables-pytest-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt...............................................................
[  0.00%] ·· Benchmarking conda-py3.6-Cython-matplotlib-numexpr-numpy-openpyxl-pytables-pytest-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt
[  2.38%] ··· Running reshape.unstack_sparse_keyspace.time_unstack_sparse_keyspace                                                                            1.80±0.03ms
[  4.76%] ··· Running sparse.sparse_arithmetic_block.time_sparse_addition                                                                                     6.54±0.07ms
[  7.14%] ··· Running sparse.sparse_arithmetic_block.time_sparse_addition_zero                                                                                 6.73±0.3ms
...
```

#### Output of ``pd.show_versions()``

<details>
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.2.final.0
python-bits: 64
OS: Darwin
OS-release: 15.4.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: ja_JP.UTF-8
LOCALE: ja_JP.UTF-8

pandas: 0.20.3
pytest: 3.2.1
pip: 9.0.1
setuptools: 32.2.0
Cython: 0.26
numpy: 1.13.1
scipy: 0.19.1
xarray: None
IPython: 6.1.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999999999
sqlalchemy: 1.1.14
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None
</details>



Discussion:

Resolving patch:
diff --git a/asv_bench/benchmarks/sparse.py b/asv_bench/benchmarks/sparse.py
--- a/asv_bench/benchmarks/sparse.py
+++ b/asv_bench/benchmarks/sparse.py
@@ -1,4 +1,4 @@
-from itertools import repeat
+import itertools
 
 from .pandas_vb_common import *
 import scipy.sparse
@@ -33,7 +33,7 @@ def time_sparse_from_scipy(self):
         SparseDataFrame(scipy.sparse.rand(1000, 1000, 0.005))
 
     def time_sparse_from_dict(self):
-        SparseDataFrame(dict(zip(range(1000), repeat([0]))))
+        SparseDataFrame(dict(zip(range(1000), itertools.repeat([0]))))
 
 
 class sparse_series_from_coo(object):


Test patch: