Skip to content

Request: keys() method on dataFrame #1240

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

Closed
iandanforth opened this issue May 15, 2012 · 3 comments
Closed

Request: keys() method on dataFrame #1240

iandanforth opened this issue May 15, 2012 · 3 comments
Milestone

Comments

@iandanforth
Copy link

Return a list of column names.

@changhiskhan
Copy link
Contributor

The potential for confusion here is that Series has a keys() method and it returns the index.

What's the use case? Duck typing with dict?

@wesm
Copy link
Member

wesm commented May 15, 2012

I think it's pretty harmless; DataFrame already has .iteritems(), but of course Series.values is a property, not a function call, so duck-typing isn't 100% possible. But good enough, I suppose.

Note that list(df) is the same as what would be df.keys()

@iandanforth
Copy link
Author

While learning Pandas this kind of method is useful to move from the well-understood dict structure to the more powerful DataFrame. As a pandas novice this kind of mental mapping would be much appreciated.

@wesm wesm closed this as completed in fc1c513 May 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants