BUG: SeriesGroupBy.hist ignores input arguments in python2
See original GitHub issueCode Sample, a copy-pastable example if possible
%matplotlib inline
import numpy as np
import pandas as pd
N = 100
np.random.seed(0)
df = pd.DataFrame(np.append(np.random.randn(N), np.random.randn(N) / 10),
columns=['rand'])
df['group'] = [0] * N + [1] * N
df.groupby('group')['rand'].hist(color='black')
Problem description
In Python2 the inputs to GroupBy.hist
are ignored unless they are named arguments in:
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.hist.html
In python2 I get:
In python3 I get:
** There are other issues with DataFrameGroupBy.hist
(#22241) as it shares code with series plots. Is there any reason that it is not consolidated with DataFrameGroupBy.plot.hist
?
Expected Output
similar to python 3
Output of pd.show_versions()
For py2:
INSTALLED VERSIONS
commit: None python: 2.7.15.final.0 python-bits: 64 OS: Darwin OS-release: 13.4.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: None.None
pandas: 0.24.0.dev0+428.gf488e88.dirty pytest: 3.7.1 pip: 18.0 setuptools: 40.0.0 Cython: 0.28.5 numpy: 1.15.0 scipy: None pyarrow: None xarray: None IPython: 5.8.0 sphinx: None patsy: None dateutil: 2.7.3 pytz: 2018.5 blosc: None bottleneck: None tables: None numexpr: None feather: None matplotlib: 2.2.2 openpyxl: None xlrd: None xlwt: None xlsxwriter: None lxml: None bs4: None html5lib: 1.0.1 sqlalchemy: None pymysql: None psycopg2: None jinja2: 2.10 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None gcsfs: None
For py3:
INSTALLED VERSIONS
commit: None python: 3.6.6.final.0 python-bits: 64 OS: Darwin OS-release: 13.4.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8
pandas: 0.24.0.dev0+428.gf488e88.dirty pytest: 3.6.2 pip: 18.0 setuptools: 39.2.0 Cython: 0.28.3 numpy: 1.14.5 scipy: 1.1.0 pyarrow: None xarray: None IPython: 6.4.0 sphinx: 1.7.5 patsy: 0.5.0 dateutil: 2.7.3 pytz: 2018.4 blosc: None bottleneck: 1.2.1 tables: 3.4.4 numexpr: 2.6.5 feather: None matplotlib: 2.2.2 openpyxl: 2.5.4 xlrd: 1.1.0 xlwt: 1.2.0 xlsxwriter: 1.0.5 lxml: 4.2.2 bs4: 4.6.0 html5lib: 1.0.1 sqlalchemy: 1.2.8 pymysql: 0.8.1 psycopg2: None jinja2: 2.10 s3fs: 0.1.5 fastparquet: None pandas_gbq: None pandas_datareader: None gcsfs: 0.1.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
We no longer support Python2 so closing this one
Strange indeed. My guess is that in Py2 the unbound method is picking up default keyword arguments from the
hist_series
signature whereas Py3 would be picking up thecolor
kwarg from the instance. Not sure what the resolution is but sharing in case it leads to any insights for others