-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Groupby with function returning a tuple fails if index has a name #18696
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
Comments
I believe this is correct, even though it looks a bit weird. You are passing a callable e.g by multiple-indices
by an index
by an array
|
related to #11579 |
we might just need to doc this |
@achabotl a couple of examples in the doc-string might be helpful here. I'll mark it as such. |
I can potentially work on this during Pycon Sprints (2018)! |
Should this be closed since it works in 0.23.4? |
I wrote an example notebook for myself documenting the index-name-groupby behavior in 0.22.0. I can post that notebook if people think its helpful. I may need a little help posting the notebook. I don't use github much and am stuck. I tried to use nbviewer.jupyter.org to post the notebook, but I guess that website renders the notebook, and does not host it. So I want to use github to host the notebook and nbviewer to render it, but I must be missing something. |
Thanks @asdinara - closing. |
Code Sample
Problem description
In 0.21.0 (and 0.20.x), calling
groupy
with a function that returns a tuple on a DataFrame with a named index fails withValueError: Names should be list-like for a MultiIndex
. It seems to be caused by the index having a name.The sample works in 0.19.0, with the output below. The same code without
df.index.name = 'name'
works under 0.20 and 0.21.Expected Output
Output of
pd.show_versions()
pandas: 0.21.0
pytest: None
pip: 9.0.1
setuptools: 38.2.4
Cython: 0.27.3
numpy: 1.13.3
scipy: None
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.1.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: