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

Add simple attribute access to DataFrame columns #213

Closed
wants to merge 1 commit into from

Conversation

takluyver
Copy link
Contributor

This one might need some discussion, but I think it makes sense.

If a column name in a dataframe is a valid Python name and doesn't conflict with any DataFrame attributes, this lets you type df.MyColumn than df['MyColumn']. That's much handier for interactive use, especially because IPython will tab complete df.MyColumn.<tab>, while it won't by default tab complete df['MyColumn'].<tab>.

This doesn't interfere with accessing columns through the dictionary interface.

@wesm
Copy link
Member

wesm commented Oct 13, 2011

This seems useful-- it might even be possible to get tab completion but the overall computational cost (overriding __getattribute__) might be too great. Merged it into master. Thanks!

@wesm wesm closed this Oct 13, 2011
@takluyver
Copy link
Contributor Author

Thanks. I think there's a method by which objects can expose extra things for tab completion to IPython, but I that's a lower priority.

Just looking at the code, I think we'd need to register the DataFrame type with IPython.utils.generic.complete_object (see code here). I'll get round to doing it at some point.

@wesm
Copy link
Member

wesm commented Oct 13, 2011

I created an issue about this:

https://github.com/wesm/pandas/issues/230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants