Skip to content

TYP: Remove _ensure_type #32633

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

Merged
merged 4 commits into from
Mar 11, 2020

Conversation

simonjayhawkins
Copy link
Member

@simonjayhawkins simonjayhawkins commented Mar 11, 2020

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Mar 11, 2020
@simonjayhawkins simonjayhawkins added this to the 1.0.2 milestone Mar 11, 2020
@simonjayhawkins
Copy link
Member Author

@TomAugspurger do we also want to add a test and a whatsnew, or merge these changes into original PR?

@TomAugspurger
Copy link
Contributor

Thanks! This seems good for now. I don't think we would need any additional tests, but a whatsnew would be nice (fixed regression).

@simonjayhawkins
Copy link
Member Author

ok can revert test. will add whatsnew.

@simonjayhawkins simonjayhawkins added the Regression Functionality that used to work in a prior pandas version label Mar 11, 2020
@TomAugspurger
Copy link
Contributor

No harm in keeping the test.

@WillAyd
Copy link
Member

WillAyd commented Mar 11, 2020

lgtm. w.r.t. test no strong preference, though do we see ourselves getting confused with that in the future?

Maybe just my lack of familiarity with our subclassing, but not sure why we would want a reindex to return a different type than the caller

@TomAugspurger
Copy link
Contributor

I think we'll be able to track it back to this discussion.

But yes, I think in general the return type on _constructor should be the same as the input, but how we go about encouraging / requiring that is a bigger discussion.

@TomAugspurger TomAugspurger merged commit a3642ec into pandas-dev:master Mar 11, 2020
@lumberbot-app
Copy link

lumberbot-app bot commented Mar 11, 2020

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout 1.0.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 a3642ecb34b8a65a9d899f17475612b3bff411d4
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #32633: TYP: Remove  _ensure_type'
  1. Push to a named branch :
git push YOURFORK 1.0.x:auto-backport-of-pr-32633-on-1.0.x
  1. Create a PR against branch 1.0.x, I would have named this PR:

"Backport PR #32633 on branch 1.0.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

TomAugspurger pushed a commit to TomAugspurger/pandas that referenced this pull request Mar 11, 2020
@simonjayhawkins simonjayhawkins deleted the remove-_ensure_type branch March 12, 2020 11:21
SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
* remove _ensure_type by TomAugspurger

* mypy fixup

* add test

* add whatsnew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Functionality that used to work in a prior pandas version Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pandas.DataFrame.reindex_like throws if called from a derived class instance
3 participants