You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
```python
import pandas as pd
import numpy as np
a = pd.Series(np.arange(1000), dtype="Sparse[int]")
d = {i: a for i in range(30)}
%timeit df = pd.DataFrame(d, columns=list(range(len(d))))
```
before
```
679 ms ± 69.3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
```
after
```
60.5 ms ± 4.99 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
```
With Series with sparse values instead, the problem is exacerbated (note
the smaller and fewer series).
```python
a = pd.Series(np.arange(1000), dtype="Sparse[int]")
d = {i: a for i in range(50)}
%timeit df = pd.DataFrame(d, columns=list(range(len(d))))
```
Before
```
233 ms ± 14.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
```
after
```
3.72 ms ± 72.7 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
```
0 commit comments