Skip to content

Commit f41b490

Browse files
committed
add asv benchmarks
1 parent e0b468f commit f41b490

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

asv_bench/benchmarks/sparse.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from itertools import repeat
2+
13
from .pandas_vb_common import *
24
import scipy.sparse
35
from pandas import SparseSeries, SparseDataFrame
@@ -27,6 +29,12 @@ class sparse_frame_constructor(object):
2729
def time_sparse_frame_constructor(self):
2830
SparseDataFrame(columns=np.arange(100), index=np.arange(1000))
2931

32+
def time_sparse_from_scipy(self):
33+
SparseDataFrame(scipy.sparse.rand(1000, 1000, 0.005))
34+
35+
def time_sparse_from_dict(self):
36+
SparseDataFrame(dict(zip(range(1000), repeat([0]))))
37+
3038

3139
class sparse_series_from_coo(object):
3240
goal_time = 0.2

0 commit comments

Comments
 (0)