Skip to content
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

[CLN] call __finalize__ in quantile #47183

Merged
merged 2 commits into from
May 31, 2022

Conversation

theOehrly
Copy link
Contributor

In reference to #28283, this PR intends to ensure that __finalize__ is always called before returning the result of DataFrame.quantile.

This was already the case though, because __finalize__ is already called explicitly wherever necessary. Furthermore, my previous PR #46101 fixed the remaining problem with metadata propagation in quantile as that was caused by .iloc.

There remained one return statement with no call to finalize. This code is unreachable though and now removed. The check if is_list_like(q): is guaranteed to be true because a few lines up q = Index(...) and Index is list-like.

Additionally, I have added one more test to increase the coverage of the finalize tests in quantile.

(In case I am wrong and Index is not guaranteed to always be list-like, I'll add this code back and add the missing finalize call instead.)

@mroeschke mroeschke added Clean metadata _metadata, .attrs labels May 31, 2022
@mroeschke mroeschke added this to the 1.5 milestone May 31, 2022
@mroeschke mroeschke merged commit 3bf2cb1 into pandas-dev:main May 31, 2022
@mroeschke
Copy link
Member

Thanks @theOehrly (failure was unrelated)

yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
* remove unreachable code in DataFrame.quantile

* add test for increased coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean metadata _metadata, .attrs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants