Skip to content

Conversation

jbrockmendel
Copy link
Member

xref #23362

import numpy as np
import pandas as pd

a = np.random.randint(2000, 2100, size=1000)
b = np.random.randint(2000, 2100, size=1000)

x = pd.core.arrays.period_array(a, freq='B')
y = pd.core.arrays.period_array(b, freq='B')

%timeit x._concat_same_type([x, y])
6.86 µs ± 75.2 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)  # <- main
4.24 µs ± 109 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)  # <- PR

@mroeschke mroeschke added Performance Memory or execution speed performance Reshaping Concat, Merge/Join, Stack/Unstack, Explode Period Period data type labels Mar 29, 2023
@mroeschke mroeschke added this to the 2.1 milestone Mar 30, 2023
@mroeschke mroeschke merged commit b522e7e into pandas-dev:main Mar 30, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the perf-ndarray-concat branch March 30, 2023 16:45
topper-123 pushed a commit to topper-123/pandas that referenced this pull request Apr 1, 2023
* PERF: concat_same_type for PeriodDtype

* mypy fixup
@jbrockmendel jbrockmendel mentioned this pull request Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Memory or execution speed performance Period Period data type Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants