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.T
is declared like so:This breaks automatic backend switching in a very subtle way. Because we use the
QueryCompilerCaster
ABC to replace all methods with a wrapper that picks the correct backend, thetranspose
referenced inproperty(transpose)
is actually the original, unwrapped method, and therefore never uses the switching code path. This PR replaces the definition ofT
withwhich defers lookup of
transpose
to runtime, and therefore uses the caster wrapper correctly.I initially attempted to add special logic to wrap
fget
/fset
/fdel
or 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 likecolumns
andindex
.flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py
black --check modin/ asv_bench/benchmarks scripts/doc_checker.py
git commit -s
docs/development/architecture.rst
is up-to-date