Skip to content

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Feb 26, 2014

closes #6484

seems on a full vbench to somewhat speedup some reindexing operations.. but this particular is not vbenched

In [13]: pn = pd.Panel(np.random.random((12, 5412, 162)))

In [14]: ix = np.ones(pn.shape[1], dtype=bool)

In [15]: ix[np.random.random(ix.size) > 0.5] = 0

In [16]: %timeit pn.loc[0, ix]  # one field, as fast as dataframe
1000 loops, best of 3: 981 µs per loop

In [17]: %timeit pn.loc[[0, 1], ix]  # two fields, 233x slower
>>> %timeit pn.loc[:, ix]
100 loops, best of 3: 18.6 ms per loop

In [18]: >>> %timeit pn.loc[:, ix]
10 loops, best of 3: 47.5 ms per loop

In [19]: pn_t = pn.swapaxes(0, 1).copy()  # try .loc on the first axis

In [20]: %timeit pn_t.loc[ix]
10 loops, best of 3: 42.8 ms per loop

jreback added a commit that referenced this pull request Feb 27, 2014
PERF: perf improvements in single-dtyped indexing (GH6484)
@jreback jreback merged commit 6c3755b into pandas-dev:master Feb 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PERF: non-info axes slicing on Panels is slow
1 participant