Add 'name' as argument for index 'to_frame' method by henriqueribeiro · Pull Request #22580 · pandas-dev/pandas (original) (raw)

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

henriqueribeiro

Since series to_frame method has a name argument, I believe it makes sense for index also have it.

@henriqueribeiro

@henriqueribeiro

@TomAugspurger

The problem is that a name argument doesn’t make sense for a MultiIndex. Not sure what’s best here.

TomAugspurger

"""
from pandas import DataFrame
name = self.name or 0
if not name:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would have to be if name is not None, to allow falsey names.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right! I will change that

@henriqueribeiro

@codecov

@henriqueribeiro

@TomAugspurger regarding MultiIndex, I'm not seeing how this name will affect MultiIndex. Can you enlight me please?

@jbrockmendel

Override for MI with plural names?

@TomAugspurger

@gfyoung

@henriqueribeiro : Thanks for the contribution! In the future, if you could open an issue before opening the PR, that would allow us to evaluate the idea first before implementing.

@henriqueribeiro

@henriqueribeiro

@pep8speaks

@henriqueribeiro

@henriqueribeiro

@TomAugspurger I cannot understand why some checks are failing. Can you give me some help please?

@TomAugspurger

There was a new release of openpyxl that's incompatible with pandas. It's been worked around on master, so you need to fetch upstream and push your changes.

git fetch upstream
git merge upstream/master
git push origin

jreback

TomAugspurger

@henriqueribeiro

@TomAugspurger

@henriqueribeiro

@henriqueribeiro

TomAugspurger

Parameters
----------
index : boolean, default True
Set the index of the returned DataFrame as the original Index.
name : object, default None
The passed name should substitute for the series name (if it has

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'series' -> 'index'

@TomAugspurger

Needs a release note too, for 0.24

@henriqueribeiro

@henriqueribeiro

@TomAugspurger Regarding the release notes, should I add this on the indexing section of v0.24.0.txt?

@TomAugspurger

@henriqueribeiro

@henriqueribeiro

TomAugspurger

@henriqueribeiro

@henriqueribeiro

TomAugspurger

jreback

@jreback

lgtm. was there not a referenced issue?

@henriqueribeiro

No. This came from dask and that's why I created the pull request immediately.

@gfyoung

All green, and since @jreback has already approved this, merging.

@gfyoung

@henriqueribeiro

aeltanawy pushed a commit to aeltanawy/pandas that referenced this pull request

Sep 20, 2018

@henriqueribeiro @aeltanawy

Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request

Oct 1, 2018

@henriqueribeiro