FIX-#7653: Respect AutoSwitchBackend for DataFrame.T/`Series.T~
#7654
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.
What do these changes do?
Currently,
DataFrame.Tis declared like so:This breaks automatic backend switching in a very subtle way. Because we use the
QueryCompilerCasterABC to replace all methods with a wrapper that picks the correct backend, thetransposereferenced inproperty(transpose)is actually the original, unwrapped method, and therefore never uses the switching code path. This PR replaces the definition ofTwithwhich defers lookup of
transposeto runtime, and therefore uses the caster wrapper correctly.I initially attempted to add special logic to wrap
fget/fset/fdelor property objects inQueryCompilerCaster, but this became complicated and also didn't work for some reason--somehow, even though I was able to wrapfget, the wrapped function was never called. The approach in this PR is simpler, and runs a lower risk of breaking behavior or accidentally causing thrashing for other commonly-accessed properties likecolumnsandindex.flake8 modin/ asv_bench/benchmarks scripts/doc_checker.pyblack --check modin/ asv_bench/benchmarks scripts/doc_checker.pygit commit -sdocs/development/architecture.rstis up-to-date