-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Untangle reshape imports --> Define pivot_table in DataFrame #17215
Conversation
so that core.frame can import these safely at the top of the module. This allows us to define DataFrame.pivot_table inside DataFrame instead of pinning it on from reshape.pivot This also lets us put docstrings in _shared_docs adjacent to the implementations without having to contort ourselves to make sure imports are ordered correctly.
…master/pandas into reshape_imports
Codecov Report
@@ Coverage Diff @@
## master #17215 +/- ##
==========================================
- Coverage 91.02% 90.98% -0.05%
==========================================
Files 162 162
Lines 49517 49539 +22
==========================================
Hits 45075 45075
- Misses 4442 4464 +22
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #17215 +/- ##
==========================================
- Coverage 91.02% 90.98% -0.05%
==========================================
Files 162 162
Lines 49517 49539 +22
==========================================
Hits 45075 45075
- Misses 4442 4464 +22
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #17215 +/- ##
==========================================
- Coverage 91.02% 90.98% -0.05%
==========================================
Files 162 162
Lines 49517 49539 +22
==========================================
Hits 45075 45075
- Misses 4442 4464 +22
Continue to review full report at Codecov.
|
I like the other soln better. This is going backwards. |
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