Skip to content

ENH: Add basic support for pd.DataFrame.hist pd.Series.hist #14

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 28, 2019
Merged

ENH: Add basic support for pd.DataFrame.hist pd.Series.hist #14

merged 4 commits into from
Aug 28, 2019

Conversation

pratapvardhan
Copy link
Contributor

@pratapvardhan pratapvardhan commented Aug 27, 2019

df = pd.DataFrame(np.random.randn(1000, 4), columns=list('ABCD'))
df.hist()

image

df['A'].hist()

image

@jakevdp
Copy link
Member

jakevdp commented Aug 27, 2019

What's the difference between these functions and data.plot.hist()?

Also, I'm not certain these methods were intended to be accessible to alternative plotting backends (see pandas-dev/pandas#28159 (comment) & discussion there)

@pratapvardhan
Copy link
Contributor Author

pratapvardhan commented Aug 27, 2019

I think, the default df.plot.hist() overlays each column's distribution in a single plot. Whereas, df.hist() creates a grid (a plot for each column).

Also, if we enable, altair backend, df.hist() fails if we don't define it.

@jakevdp
Copy link
Member

jakevdp commented Aug 27, 2019

Also, if we enable, altair backend, df.hist() fails if we don't define it.

Right, but it's unclear whether it was intentional to allow plotting backends to override df.hist(). See the linked discussion above.

@pratapvardhan
Copy link
Contributor Author

Understood. I'm okay with anything we decide. Will see how the pandas PR evolves.

@jakevdp
Copy link
Member

jakevdp commented Aug 27, 2019

Thinking on this more, we may as well add this. If pandas deprecates these functionalities, we can always remove them.

Mind adding some tests for this? Thanks!

@pratapvardhan
Copy link
Contributor Author

@jakevdp -- tests added.

@jakevdp
Copy link
Member

jakevdp commented Aug 28, 2019

Thanks!

@jakevdp jakevdp merged commit c10585d into altair-viz:master Aug 28, 2019
@pratapvardhan pratapvardhan deleted the hist_func branch August 29, 2019 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants