Skip to content

BUG: weights is not working for multiple columns in df.plot.hist #33440

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 12 commits into from
Apr 10, 2020

Conversation

charlesdong1991
Copy link
Member

@charlesdong1991 charlesdong1991 commented Apr 9, 2020

df2 = pd.DataFrame(dict(zip(["A", "B"], 0.1 * np.random.randn(2, 100,))))
ax2 = _check_plot_works(df2.plot, kind="hist")

self._check_data(ax1, ax2)
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way in the test to check that the weights are appropriately rendered by column?

Copy link
Member Author

@charlesdong1991 charlesdong1991 Apr 10, 2020

Choose a reason for hiding this comment

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

thanks for taking a look! @WillAyd

good point, i slightly changed the test, and i think: in order to check weights to be rendered appropriately, we could use height in rectangle patches because histogram is essentially rectangles. therefore, for instance, weights for all is 0.1 as in original example, the height of plot should be 0.1 times of original one without weights.

what do you think of this approach?

@charlesdong1991 charlesdong1991 requested a review from WillAyd April 10, 2020 11:19
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm

@jreback jreback added this to the 1.1 milestone Apr 10, 2020
@jreback jreback merged commit 2a68c12 into pandas-dev:master Apr 10, 2020
@jreback
Copy link
Contributor

jreback commented Apr 10, 2020

thanks @charlesdong1991

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting histogram weights for multiple columns fails
3 participants