Skip to content

PERF: ArrowExtensionArray._from_sequence #52256

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 1 commit into from
Mar 28, 2023

Conversation

lukemanley
Copy link
Member

Avoid an unnecessary cast in ArrowExtensionArray._from_sequence.

Noticed the time spent there when transposing and arrow-backed dataframe:

import pandas as pd
import numpy as np
import pyarrow as pa

data = np.random.randn(10_000, 10)
dtype = pd.ArrowDtype(pa.float64())
df = pd.DataFrame(data, dtype=dtype)

%timeit df.T

# 254 ms ± 14.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)    <- main
# 169 ms ± 3.69 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)  <- PR

@lukemanley lukemanley added Performance Memory or execution speed performance Arrow pyarrow functionality labels Mar 28, 2023
@mroeschke mroeschke added this to the 2.1 milestone Mar 28, 2023
@mroeschke mroeschke merged commit d86cdb0 into pandas-dev:main Mar 28, 2023
@mroeschke
Copy link
Member

Thanks @lukemanley

@lukemanley lukemanley deleted the arrow-avoid-unnecessary-cast branch April 18, 2023 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants