Untangle reshape imports --> Define pivot_table in DataFrame #17215
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.
This is an alternative to #17174. This is ultimately a better solution to the issue there, but involves a more invasive refactoring.
To recap:
Right now
DataFrame.pivot_table
is defined incore.reshape.pivot
withDataFrame.pivot_table = pivot_table
. The original and main goal of this (and move pivot_table doc-string to DataFrame #17174) is to avoid that, and instead defineDataFrame.pivot_table
within theDataFrame
class definition.Doing this makes the docstrings tricky, since we want
pivot_table.__doc__
to be shared byreshape.pivot.pivot_table
andDataFrame.pivot_table
. To resolve this cleanly, we need to importreshape.pivot
at the top ofcore.frame
. Doing this requires getting the import ofDataFrame
out ofreshape.pivot
(and anything else it imports, namelyreshape.concat
).Bonus: If/when this is approved, all of the mid-module imports of
reshape.concat
can be moved to the top ofcore.frame
, and a handful of other docstrings can be put into_shared_docs
in more convenient locations.Bonus 2: If/when this is approved, doing the same thing in
reshape.merge
andreshape.tile
is very easy.reshape.reshape
is doable but take a bit more work.git diff upstream/master -u -- "*.py" | flake8 --diff