question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: SeriesGroupBy.hist ignores input arguments in python2

See original GitHub issue

Code 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: image

In python3 I get: image

** 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:

No module named 'dask'

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:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
WillAydcommented, Sep 19, 2019

We no longer support Python2 so closing this one

1reaction
WillAydcommented, Aug 16, 2018

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 the color kwarg from the instance. Not sure what the resolution is but sharing in case it leads to any insights for others

Read more comments on GitHub >

github_iconTop Results From Across the Web

pandas.core.groupby.SeriesGroupBy.hist doesn't take kwargs
I'd like to pass certain kwargs to the hist function of a SeriesGroupBy object (alpha, legend, etc). The plot function provides more kwargs ......
Read more >
What's new in 1.4.0 (January 22, 2022) - Pandas
Notable bug fixes# ; Ignoring dtypes in concat with empty or all-NA columns# · In [18]: df1 ; Null-values are no longer coerced...
Read more >
How to update pandas DataFrame.drop() for Future Warning ...
DataFrame.drop has the following parameters: ... 'raise'}, default 'raise' If 'ignore', suppress error and only existing labels are dropped.
Read more >
What's New — pandas 0.19.2 documentation
Bug in pd.read_csv for the Python engine in which an unhelpful error ... nrows parameter was not being respected for large input when...
Read more >
Changelog - Dask documentation
Add docs on running Dask in a standalone Python script (GH#9513) James ... Fix bug in dask.array.roll() for roll-shifts that match the size...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found