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

API: consider deprecating DataFrame.hist in favor of DataFrame.plot.hist #11053

Open
shoyer opened this issue Sep 10, 2015 · 12 comments
Open

API: consider deprecating DataFrame.hist in favor of DataFrame.plot.hist #11053

shoyer opened this issue Sep 10, 2015 · 12 comments
Labels
Deprecate Functionality to remove in pandas Visualization plotting

Comments

@shoyer
Copy link
Member

shoyer commented Sep 10, 2015

This came up in the PR adding plot submethods like .plot.hist: #9321 (comment)

As long as API differences can be reconciled, I think it would be a nice idea to deprecate (and eventually remove) DataFrame.hist, DataFrame.boxplot and Series.hist in favor of the accessor mtehods.

This old issue discusses API differences (possibly no longer accurate/relevant?): #413

@shoyer shoyer mentioned this issue Sep 10, 2015
16 tasks
@jreback jreback added this to the 0.18.0 milestone Sep 10, 2015
@jreback
Copy link
Contributor

jreback commented Jan 24, 2016

@shoyer @TomAugspurger either one of you for 0.18.0?

@jreback jreback modified the milestones: 0.19.0, 0.18.0 Feb 10, 2016
@ResidentMario
Copy link
Contributor

ResidentMario commented Feb 27, 2017

Excuse my naivete, but what is to be done here? I did a quick test and all of the DataFrame.plot arguments seem to work when passed into sub-methods (granted, I did not test this extensively, but...).

@jreback
Copy link
Contributor

jreback commented Feb 27, 2017

DataFrame.hist, DataFrame.boxplot and Series.hist in favor of

DataFrame.plot.hist etc

this issue is about emitting a deprecation for these (the replace is already there)

@jreback jreback added the Deprecate Functionality to remove in pandas label Feb 27, 2017
@ResidentMario
Copy link
Contributor

Is this as simple as tossing a bunch of deprecate decorators onto things, then?

@jreback
Copy link
Contributor

jreback commented Feb 27, 2017

@ResidentMario

I think these are actually defined in pandas.tools.plotting.hist_series as a real method. I think that should be removed and instead direct to the plotting accessor.

@TomAugspurger @jorisvandenbossche

@ResidentMario
Copy link
Contributor

ResidentMario commented Feb 27, 2017

Well, the hist_series code does include this comment:

# hack until the plotting interface is a bit more unified

Not a typical comment in pandas source code. 😄 So it does indeed sound like things are a bit more complicated than that.

PS: I think that closing this should also correspond with closing one of the oldest issues still open, #413.

@jreback
Copy link
Contributor

jreback commented Feb 27, 2017

yeah, plotting is like Alice-in-wonderland..........

@jreback jreback modified the milestones: 0.20.0, 0.21.0 Mar 23, 2017
@jbrockmendel
Copy link
Member

Out of curiosity, why are plot, hist, and boxplot defined at the bottom of frames.py instead of included in the class definition? Same goes for Series.plot and Series.hist.

@jreback
Copy link
Contributor

jreback commented Jul 13, 2017

@jbrockmendel I think these are all historical. No reason they should not be deprecated / fixed. (refering to.hist and .boxplot); .plot is by-definition the namespace

@jreback
Copy link
Contributor

jreback commented Sep 23, 2017

anyone want to do this deprecation?

@jreback jreback modified the milestones: 0.21.0, 1.0 Oct 2, 2017
@mangecoeur
Copy link
Contributor

I've noticed that .hist() and .plot.hist() give different outputs (pandas 0.22, matplotlib 2.2) - I opened issue #21048 . I don't know if this happens in all cases but I guess this should be addressed before hist() is replaced by plot.hist()

@TomAugspurger
Copy link
Contributor

Right, part of the deprecation would be providing a way to achieve the behavior of DataFrame.hist within .plot.hist. Copying over your example here.


from @mangecoeur in #21048 (comment)

Code Sample, a copy-pastable example if possible

cols = ['heat_total', 'area_density', 'mean_n_floors',
       'n_buildings', 'area_demand_density_grid', 'floor_demand_density']

plt.figure()
df[cols].plot.hist(
    bins=20,
    alpha=0.5
)

plt.figure()
df[cols].hist(
    bins=20,
    alpha=0.5
)

Problem description

df.hist() and df.plot.hist() give different plots: .hist() plots a grid of figures while .plot.hist() plots overlapping distributions.

Result of df.hist()

hist

Result df.plot.hist()

plothist

Expected Output

.hist() and .plot.hist() should give exactly the same results

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.3.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.22.0
pytest: 3.2.1
pip: 9.0.1
setuptools: 36.5.0.post20170921
Cython: 0.26.1
numpy: 1.14.2
scipy: 0.19.1
pyarrow: None
xarray: 0.10.0
IPython: 6.2.1
sphinx: 1.6.3
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.2.2
openpyxl: 2.4.9
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.0
bs4: 4.6.0
html5lib: 0.999999999
sqlalchemy: 1.1.13
pymysql: None
psycopg2: 2.7.4 (dt dec pq3 ext lo64)
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@TomAugspurger TomAugspurger modified the milestones: 1.0, Contributions Welcome Dec 30, 2019
@jreback jreback modified the milestones: Contributions Welcome, 1.4 Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Visualization plotting
Projects
None yet
Development

No branches or pull requests

7 participants