-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: remove usage of _constructor._get_axis_number (fix when _constructor properties return callables) #46018
BUG: remove usage of _constructor._get_axis_number (fix when _constructor properties return callables) #46018
Conversation
…ctor properties return callables)
Found one more, in |
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.
no objection, can you add a whatsnew
tests are failing as well :-> |
Ah, that's another case, but where we didn't call a method on it, but used in an |
pandas/core/reshape/concat.py
Outdated
@@ -539,7 +542,7 @@ def __init__( | |||
self.new_axes = self._get_new_axes() | |||
|
|||
def get_result(self): | |||
cons: type[DataFrame | Series] | |||
cons: Callable |
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.
could annotate as Callable returning DataFrame|Series
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.
The Callable
typing is actually giving errors .. (with or without return type)
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.
Ah, but I probably have to update the actual properties' annotation to callable as well
Are people OK with considering this for 1.4.x? (the actual change is quite small, the bulk of the diff is due to typing) This is actually fixing a regression for geopandas, although not a regression in 1.4.0, but somewhere between 1.0 and 1.4. |
@meeseeksdev backport 1.4.x |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@jorisvandenbossche if you can push a manual backport |
…axis_number (fix when _constructor properties return callables)
The auto backport failed as #45272 is not backported. The changes here to that code were only the mypy comments. Those changes have therefore been omitted in the manual backport. |
…r (fix when _constructor properties return callables) (#46228) Co-authored-by: Joris Van den Bossche <[email protected]>
…ctor properties return callables) (pandas-dev#46018)
See report at #32860 (comment) (and we also run into this one case in geopandas). Also related to #32638
As far as I know this is the only remaining case where we rely on
_constructor
/_constructor_sliced
/_constructor_expanddim
returning a class and not a generic callable (in geopandas, we also have a workaround for this one case).This specific case was introduced in #34837 to avoid circular dependencies/imports, so therefore I added the DataFrame import inline.