Skip to content

Extending Dataframe #7868

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
paddymul opened this issue Jul 29, 2014 · 2 comments
Closed

Extending Dataframe #7868

paddymul opened this issue Jul 29, 2014 · 2 comments

Comments

@paddymul
Copy link
Contributor

I'm interested if there are recommended best practices for extending DataFrames.

I work on a project where we have an API for querying a database that returns DataFrames. I basically want a way to associate extra metadata with each column in the DataFrame. At a minimum this would allow me to run commands like df.some_column.canonical_url and get a link back to a web service.

There are some other things that I would like to do like giving columns aliases for better legends when plotted.

I know I could return a wrapped DataFrame object from the api, but the DataFrame would lose its wrapper once operations were performed.

@jreback
Copy link
Contributor

jreback commented Jul 29, 2014

see #2485 for a long discussion.

You can do this in >= 0.14.0 by utilizing __finalize__().

see this PR's tests for basically doing this. https://github.com/pydata/pandas/pull/6931/files

Its straightforward, but you have to deal with the propogation issues. E.g. How to decide between different meta data.

@jreback
Copy link
Contributor

jreback commented Mar 8, 2015

closing as discussion in #2485

@jreback jreback closed this as completed Mar 8, 2015
@jreback jreback added this to the No action milestone Mar 8, 2015
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

2 participants