-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Add 'name' as argument for index 'to_frame' method #22580
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
Add 'name' as argument for index 'to_frame' method #22580
Conversation
The problem is that a name argument doesn’t make sense for a MultiIndex. Not sure what’s best here. |
pandas/core/indexes/base.py
Outdated
""" | ||
|
||
from pandas import DataFrame | ||
name = self.name or 0 | ||
if not name: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Codecov Report
@@ Coverage Diff @@
## master #22580 +/- ##
==========================================
+ Coverage 92.17% 92.17% +<.01%
==========================================
Files 169 169
Lines 50708 50716 +8
==========================================
+ Hits 46740 46748 +8
Misses 3968 3968
Continue to review full report at Codecov.
|
@TomAugspurger regarding MultiIndex, I'm not seeing how this |
Override for MI with plural names? |
Probably best to keep the signature the same for MI, but indicate that
`name` should be a sequence of strings matching the number of levels.
Can you add a test for that, and implement it if it's broken?
…On Mon, Sep 3, 2018 at 12:20 PM jbrockmendel ***@***.***> wrote:
Override for MI with plural names?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22580 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIsYSWknpOduW3KyEA1uzSpohgEfQks5uXWTxgaJpZM4WXb1h>
.
|
@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. |
Hello @henriqueribeiro! Thanks for updating the PR.
Comment last updated on September 08, 2018 at 15:33 Hours UTC |
@gfyoung Sure! Sorry for that |
@TomAugspurger I cannot understand why some checks are failing. Can you give me some help please? |
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.
|
@henriqueribeiro linting error https://travis-ci.org/pandas-dev/pandas/jobs/425773293#L3653 and it looks like you may need to merge master still. |
pandas/core/indexes/base.py
Outdated
|
||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'series' -> 'index'
Needs a release note too, for 0.24 |
@TomAugspurger Regarding the release notes, should I add this on the indexing section of v0.24.0.txt? |
Probably under the "Other Enhancements" section.
…On Tue, Sep 11, 2018 at 5:23 AM henriqueribeiro ***@***.***> wrote:
@TomAugspurger <https://github.com/TomAugspurger> Regarding the release
notes, should I add this on the indexing section of v0.24.0.txt?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22580 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIrIxCtuDKYcHf8Zju-pGGLo8Rin7ks5uZ48PgaJpZM4WXb1h>
.
|
lgtm. was there not a referenced issue? |
No. This came from dask and that's why I created the pull request immediately. |
All green, and since @jreback has already approved this, merging. |
Thanks @henriqueribeiro ! |
Thanks to @TomAugspurger for this "ping-pong" fixing. |
git diff upstream/master -u -- "*.py" | flake8 --diff
Since series
to_frame
method has aname
argument, I believe it makes sense for index also have it.