-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Move GroupBy to Submodule and Add FutureWarning #20506
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
Conversation
pandas/tests/api/test_api.py
Outdated
"Grouper", "groupby", "BinGrouper", "Grouper", "_GroupBy", "GroupBy", | ||
"SeriesGroupBy", "_pipe_template", "PanelGroupBy", "Grouping", | ||
"SpecificationError", "DataError", "generate_bins_generic"]) | ||
def test_groupby_move(self, attr): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be straightforward to combine with the method above if we wanted one test accepting a module / list of objects to test the deprecation for
There was a failure in one of the "Allowed Failures" as a result of a |
pandas/core/groupby/__init__.py
Outdated
stacklevel=2) | ||
|
||
from pandas.core.groupby.groupby import Grouper # noqa: F401 | ||
from pandas.core.groupby.groupby import groupby # noqa: F401 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can u import these in 1 statement
pandas/core/groupby/__init__.py
Outdated
from pandas.core.groupby.groupby import GroupBy # noqa: F401 | ||
from pandas.core.groupby.groupby import SeriesGroupBy # noqa: F401 | ||
from pandas.core.groupby.groupby import _pipe_template # noqa: F401 | ||
from pandas.core.groupby.groupby import PanelGroupBy # noqa: F401 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are all these imports actually needed?
just change where they r used
FYI there are NO allowed failures, meaning that yes these will allow the build to complete earlier, but generally we don't merge things if they are causing issues. |
pandas/core/groupby/__init__.py
Outdated
|
||
from pandas.core.groupby.groupby import Grouper # noqa: F401 | ||
from pandas.core.groupby.groupby import groupby # noqa: F401 | ||
from pandas.core.groupby.groupby import BinGrouper # noqa: F401 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only put public functions here. If something is needed internally then change the reference to it.
Codecov Report
@@ Coverage Diff @@
## master #20506 +/- ##
==========================================
+ Coverage 91.82% 91.84% +0.02%
==========================================
Files 152 153 +1
Lines 49255 49256 +1
==========================================
+ Hits 45226 45239 +13
+ Misses 4029 4017 -12
Continue to review full report at Codecov.
|
FYI, merge conflict with master. |
Hmm so I'm not sure that the FutureWarning being in the
|
Can we just import what is needed in |
@jorisvandenbossche I already updated all the internal refs per Jeff's previous comment, but could undo if required. That said, maybe we just shouldn't put the warning on the init given the change could be transparent from an API perspective since all we are doing is moving from a single module to a like-named package? |
pandas/core/groupby/__init__.py
Outdated
"'pandas.core.groupby.groupby' instead", FutureWarning, | ||
stacklevel=2) | ||
|
||
from pandas.core.groupby.groupby import (Grouper, GroupBy, # noqa: F401 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GroupBy, SeriesGroupBy and DataFrameGroupBy were all added here as they were causing downstream failures for Dask, even though they aren't explicitly referenced internally. Once we settle on a go-forward here we'll have to follow up with the Dask team to let them know of impacts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes this is fine. These are basically downstream dev dependencies (e.g. you may want to do something based on the object if its a SeriesGroupBy or a DataFrameGroupBy) so ok with this
Yes, that's exactly what I tried to say :-) IMO, this is much cleaner (also internally, but certainly for external packages) |
pandas/core/groupby/__init__.py
Outdated
"'pandas.core.groupby.groupby' instead", FutureWarning, | ||
stacklevel=2) | ||
|
||
from pandas.core.groupby.groupby import (Grouper, GroupBy, # noqa: F401 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes this is fine. These are basically downstream dev dependencies (e.g. you may want to do something based on the object if its a SeriesGroupBy or a DataFrameGroupBy) so ok with this
pandas/core/resample.py
Outdated
from pandas.core.groupby import (BinGrouper, Grouper, _GroupBy, GroupBy, | ||
SeriesGroupBy, groupby, PanelGroupBy, | ||
_pipe_template) | ||
from pandas.core.groupby.groupby import (BinGrouper, Grouper, _GroupBy, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style nit, I like to see a newline after the parens so these are wrapped a bit
very tiny style issue, ping on green. |
@jreback did you see our discussion above? So -1 on merge on green. There is no need to deprecate this (and we can still move to a subpackage) |
@jorisvandenbossche sorry, I did see that. yeah we can not deprecate is fine. |
Does anyone develop on Windows? Trying to figure out why CircleCI is failing but can't reproduce the issue locally. An easy way to solve it would be to add BinGrouper back to the API in the |
CircleCI is also linux, not windows. But why it is failing there and not in the others, I don't know. I would also like to advocate to keep the internal imports the same as before (so import into |
@jreback what do you think about Joris' comment? Should I put everything back into the |
i would move non public this out of the init |
thanks @WillAyd |
`pandas.core.groupby` has been moved to `pandas.core.groupby.groupby` for pandas 0.23.0. See pandas pull request [#20506](pandas-dev/pandas#20506).
ref #20485 @jreback