Skip to content

pandas.core.groupby.SeriesGroupBy.hist doesn't propagate **kwargs #14107

Closed
@yonatanp

Description

@yonatanp

When calling my_groupby.hist(bins=8, histtype='stepfilled') I would expect the same behavior as when calling my_series.hist(bins=8, histtype='stepfilled') separately for each of the groups.
However, while the 'bins' parameter is taken into account, the 'histtype' parameter is ignored and not passed along to matplotlib's implementation.

Looking into the code, it appears that pandas.core.groupby._whitelist_method_generator only passes along named arguments of the wrapped method (hist in our example). While the signature was fixed to include any *args or **kwargs arguments (done to fix #8733), they are not passed on.

Note: the problem applies to all 'wrappers' generated by _whitelist_method_generator (in addition to 'hist'), and also to any use of *args (in addition to **kwargs).

We are working on a PR and will send it soon.

output of pd.show_versions()

commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Darwin
OS-release: 15.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8

pandas: 0.18.1
nose: 1.3.7
pip: 8.1.2
setuptools: 24.0.0
Cython: 0.23.4
numpy: 1.11.1
scipy: 0.17.1
statsmodels: 0.6.1
xarray: None
IPython: 4.0.1
sphinx: 1.3.1
patsy: 0.4.0
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.5.2
matplotlib: 1.5.1
openpyxl: 2.2.6
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.7.7
lxml: 3.4.4
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.9
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.38.0
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions