-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
add to_frame method to DataFrame #24336
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
Conversation
Add convenience method which makes sure that we can safely call to_frame on any method returning both Series and DataFrame instances, such as groupby etc.
Hello @letalvoj! Thanks for submitting the PR.
|
-0 on this. just cluttering the API. semantically this is alway wrong, it should copy. |
Sometimes I find people struggling to use ad. api
even some indices
Therefore I feel like it's not just some other random method. Or is it? ad. copying |
Codecov Report
@@ Coverage Diff @@
## master #24336 +/- ##
==========================================
+ Coverage 92.28% 92.28% +<.01%
==========================================
Files 162 162
Lines 51833 51835 +2
==========================================
+ Hits 47833 47835 +2
Misses 4000 4000
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #24336 +/- ##
==========================================
+ Coverage 92.28% 92.28% +<.01%
==========================================
Files 162 162
Lines 51833 51835 +2
==========================================
+ Hits 47833 47835 +2
Misses 4000 4000
Continue to review full report at Codecov.
|
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.
needs some discussion
I don't have a strong preference here. Probably +0.5 since it makes writing generic code for Series / Frame easier (although, you won't be able to use the FWIW, Series.to_frame doesn't copy. In [6]: s = pd.Series([1, 2])
In [7]: r = s.to_frame()
In [8]: s[0] = 10
In [9]: r
Out[9]:
0
0 10
1 2 though it arguably should (as an option). |
@letalvoj do you mind writing a real case example on when this would be useful. I understand your point, but would be useful for the discussion to see how a real example would look with and without |
@letalvoj I think this needs an issue for discussion. If you'd like to open one with a realistic usecase we can see if there is appetite. closing this for now. |
Add convenience method which makes sure that we can safely call
to_frame
on any method returning bothSeries
andDataFrame
instances, such asgroupby
etc.closes Export to excel for multiindex columns #11292 xxx(there is no issue, should I open one?)git diff upstream/master -u -- "*.py" | flake8 --diff