Vbench performance benchmarks for pandas

sparse

sparse_series_to_frame

Benchmark setup

from pandas_vb_common import *

from pandas.core.sparse import SparseSeries, SparseDataFrame

K = 50
N = 50000
rng = np.asarray(DateRange('1/1/2000', periods=N,
                           offset=datetools.Minute()))

# rng2 = np.asarray(rng).astype('M8[ns]').astype('i8')

series = {}
for i in range(1, K + 1):
    data = np.random.randn(N)[:-i]
    this_rng = rng[:-i]
    data[100:] = np.nan
    series[i] = SparseSeries(data, index=this_rng)

Benchmark statement

SparseDataFrame(series)

Performance graph

_images/sparse_series_to_frame.png