Skip to content
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

API: allow list-like to DataFrame rename #15029

Closed
wants to merge 3 commits into from

Conversation

chris-b1
Copy link
Contributor

@chris-b1 chris-b1 commented Jan 1, 2017

assert_frame_equal(result, expected)

result = df.copy()
result.rename(columns=['J', 'K'], index=['a', 'b'], inplace=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

test with ndarray and with an Index
a scalar should error yes?

@codecov-io
Copy link

codecov-io commented Jan 1, 2017

Current coverage is 84.77% (diff: 100%)

Merging #15029 into master will increase coverage by <.01%

@@             master     #15029   diff @@
==========================================
  Files           145        145          
  Lines         51131      51133     +2   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43345      43348     +3   
+ Misses         7786       7785     -1   
  Partials          0          0          

Powered by Codecov. Last update 3662413...5e3848c

@jreback
Copy link
Contributor

jreback commented Jan 1, 2017

this is also now an alternative to the .index = API (which is fine I think). So can you put some references in the doc-string and update the docs (where .set_index is).

@chris-b1
Copy link
Contributor Author

chris-b1 commented Jan 1, 2017

I added a couple doc references, but I might be missing something - wasn't sure if there is a canonical spot for the .index/.columns= api?

@jreback
Copy link
Contributor

jreback commented Jan 1, 2017

http://pandas.pydata.org/pandas-docs/stable/indexing.html#set-reset-index

ad-hoc indexing. This would be expanded in any event (and maybe moved to http://pandas.pydata.org/pandas-docs/stable/basics.html#renaming-mapping-labels) as these are the same idea.

@jreback jreback added API Design Indexing Related to indexing on series/frames, not to indexes themselves labels Jan 1, 2017
@chris-b1 chris-b1 mentioned this pull request Jan 11, 2017
4 tasks
@chris-b1
Copy link
Contributor Author

Closing in favor of #15104

@chris-b1 chris-b1 closed this Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: allow DataFrame.rename to take a list-like of colums
3 participants