-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: histogram weights aren't dropped if NaN values in data #48888
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
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.
Hi, thx for this. Could you please add tests?
I've created a test where a df and set of weights are made, and one value in each column of df is set to NaN. I then make a copy of the df without the NaNs, and copies of weights with the corresponding weights dropped. It then checks that histograms made using each pair have the same heights. |
pandas/plotting/_matplotlib/hist.py
Outdated
kwds["weights"] = weights[:, i] | ||
if weights is not None: | ||
if np.ndim(weights) != 1: | ||
weights = weights[:, i] |
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.
What happens if i is out of bounds?
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 one is still open, otherwise lgtm
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.
@Ormorod doesn't look like this was addressed. Can i
be out of bounds?
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
Will merge main now. I addressed the comments above but haven't had a response. |
It also occurs to me that |
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.
LGTM merge when ready @phofl
Thx @Ormorod |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.