Skip to content

Conversation

@fangchenli
Copy link
Member

No description provided.

…eger types When converting ArrowExtensionArray to string dtype, use PyArrow's native pc.cast() for integer and string types where the string representation matches Python's str(). This avoids unnecessary conversion through NumPy. Float and boolean types still fall back to lib.ensure_string_array because PyArrow's string representation differs from Python's str(): - Float: 1.0 -> "1" (PyArrow) vs "1.0" (Python) - Bool: True -> "true" (PyArrow) vs "True" (Python) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
@fangchenlifangchenli added Arrow pyarrow functionality Performance Memory or execution speed performance labels Dec 17, 2025
Copy link
Member

@jorisvandenbosschejorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@fangchenlifangchenli marked this pull request as ready for review December 18, 2025 18:16
fangchenliand others added 2 commits December 18, 2025 18:41
When using_infer_string is False, string columns start as object dtype and get converted to Arrow, so memory is not shared. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
@mroeschkemroeschke added this to the 3.0 milestone Dec 19, 2025
@mroeschkemroeschke merged commit 476e987 into pandas-dev:mainDec 19, 2025
42 checks passed
@mroeschke
Copy link
Member

Thanks @fangchenli

@fangchenlifangchenli deleted the perf/astype-string-arrow-no-fallback branch December 19, 2025 20:11
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arrowpyarrow functionalityPerformanceMemory or execution speed performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@fangchenli@mroeschke@jorisvandenbossche