Skip to content

REGR: styler.highlight_min/max did not ignore pd.NA and caused error #42861

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
Aug 4, 2021

Conversation

attack68
Copy link
Contributor

@attack68 attack68 commented Aug 3, 2021

@simonjayhawkins simonjayhawkins added this to the 1.3.2 milestone Aug 3, 2021
@simonjayhawkins simonjayhawkins added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Styler conditional formatting using DataFrame.style labels Aug 3, 2021
@@ -2348,7 +2348,11 @@ def highlight_max(
"""

def f(data: FrameOrSeries, props: str) -> np.ndarray:
return np.where(data == np.nanmax(data.to_numpy()), props, "")
arg = {"skipna": True}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think actually just passing the arg is better here e.g. max(skipna=True) as more readable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i refactored this, pulling the function out, have a relook

@jreback jreback merged commit b9edc9a into pandas-dev:master Aug 4, 2021
@jreback
Copy link
Contributor

jreback commented Aug 4, 2021

thanks @attack68

@jreback
Copy link
Contributor

jreback commented Aug 4, 2021

@meeseeksdev backport 1.3.x

@lumberbot-app
Copy link

lumberbot-app bot commented Aug 4, 2021

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.3.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 b9edc9a2a3e9cb3251b55e42a87cff2ded2ae6cb
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #42861: REGR: `styler.highlight_min/max` did not ignore `pd.NA` and caused error'
  1. Push to a named branch :
git push YOURFORK 1.3.x:auto-backport-of-pr-42861-on-1.3.x
  1. Create a PR against branch 1.3.x, I would have named this PR:

"Backport PR #42861 on branch 1.3.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.

@lumberbot-app
Copy link

lumberbot-app bot commented Aug 4, 2021

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.3.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 b9edc9a2a3e9cb3251b55e42a87cff2ded2ae6cb
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #42861: REGR: `styler.highlight_min/max` did not ignore `pd.NA` and caused error'
  1. Push to a named branch :
git push YOURFORK 1.3.x:auto-backport-of-pr-42861-on-1.3.x
  1. Create a PR against branch 1.3.x, I would have named this PR:

"Backport PR #42861 on branch 1.3.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.

attack68 added a commit to attack68/pandas that referenced this pull request Aug 4, 2021
@attack68 attack68 deleted the correct_highlight_min branch August 4, 2021 10:28
@attack68
Copy link
Contributor Author

attack68 commented Aug 4, 2021

linking #42879

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Styler conditional formatting using DataFrame.style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: highlight_min and highlight_max do not work with pd.NA
3 participants