Repository navigation
Skip the float64 copy of pandas and Polars input - #786
Merged
Merged
Conversation
astype(float) copied every float64 Series again after to_numpy(); with copy=False, only input that is not already float64 is converted.
Member
|
Nice! |
Member
|
Oh oops I thought this was to main branch! |
Member
|
But I liked it, so I cherry-picked it to main. |
Member
Author
|
No problem for the merge to dev. Glad that this is heading in the next release ... one way or another 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
to_numpy()already returns float64 for a float64 Series, andastype(float)then copied it again on every call, in the Function, abstract and stream APIs. Withcopy=False,astypeconverts only input that is not float64 yet, so results are unchanged.Median time per call, before and after, for pandas float64 into ATR. Two source builds per host (dev and this branch, both with TA-Lib C 0.8.3), 3 processes each, Python 3.12, numpy 2.5.3, pandas 3.1.0, polars 1.44.2:
Opening a stream on a function that reads little history gains most: ADD at 100,000 rows is 47.6 → 1.5 µs, 96.8% faster. Polars gains more than pandas; nullable
Float64, Arrow-backed and 2-D-built DataFrame columns gain too. Outputs were identical in every case, including leading NaN or null.Two things change: