Skip to content

PERF: concat #52291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 31, 2023
Merged

PERF: concat #52291

merged 3 commits into from
Mar 31, 2023

Conversation

jbrockmendel
Copy link
Member

xref #23362 (closes? not sure how much more we can do)

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')

s = pd.Series(x)
t = pd.Series(y)


In [2]: %timeit pd.concat([s, t], ignore_index=True)
54.6 µs ± 2.41 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)  # <- PR
81.5 µs ± 419 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)  # <- main

cc @phofl do we need to do anything else refs-wise? when calling Manager.from_array?

@mroeschke mroeschke added Performance Memory or execution speed performance Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Mar 29, 2023
@phofl
Copy link
Member

phofl commented Mar 30, 2023

I think we only get there when we have axis=0 which creates a copy anyway, so no we are good

This was referenced Mar 30, 2023
@jbrockmendel
Copy link
Member Author

@mroeschke updated + green includes typing fix for main

@mroeschke mroeschke added this to the 2.1 milestone Mar 31, 2023
@mroeschke mroeschke merged commit 1c2ad16 into pandas-dev:main Mar 31, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the perf-concat branch March 31, 2023 22:52
topper-123 pushed a commit to topper-123/pandas that referenced this pull request Apr 1, 2023
@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 Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants