[ArrowStringArray] PERF: bypass some padding code in _wrap_result #41567
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.
The padding of np.nan across all columns is not needed for StringArray/ArrowStringArray
this is a small change for perf.
The padding code logic does not work for st.extract since the first value of a list maybe np.nan followed by other values. I made that change here and then reverted as is moreless perf neutral. so will do in another PR that uses _wrap_result more for str_extract. (str.extract returns list of lists where any value in the list could be np.nan, str.split returns array of lists with different lengths without np.nans and the np.nans returned as scalars)
some further gains can also be achieved by bypassing the converting of
np.nan
to[np.nan]
for partition (for StringArray/ArrowStringArray) since the DataFrame constructor does not need this for a list of tuples. (str.partition returns array of tuples, str.split returns array of lists) #41507