-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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: make attribute setting de-facto insert column #9033
Comments
I think this change should be considered very very very carefully. It is a gigantic change to the API. It means that any later additions of new methods or attributes to DataFrame may unexpectedly break tons of code. For instance, if I have code that does |
@BrenBarn Thanks for commenting, you've convinced me. This indeed seems very dangerous. |
yeh, this was sort of pie-in-the-sky. To promote consistency. In theory its a nice idea, but by auto-converting to a column, then you pretty much preclude future method expansion. Fundamentally there is really ONE way to create columns, namely |
Personally, this would break my library as attribute setting is hacked in. I'm not sure if it would affect GeoPandas, since they have honest-to-goodness dataframe subclasses, and I'm using composite classes. Not that I think this should hold you back from a major release, but personally I'm not a fan of this behavior. The attribute setting syntax is pretty consistent throughout Python, and it's not really that difficult to do If you do put this through, can you do a small writeup about how to use the |
@hugadams you might find this interesting reading (near the bottom): http://pandas.pydata.org/pandas-docs/stable/internals.html |
Ha wow, I need to keep up I guess! On Thu, May 21, 2015 at 12:24 PM, jreback [email protected] wrote:
Adam Hughes |
closeble? |
xref #8994
xref #5904
xref #8572
This might be a bit controversial, but the issues raised in #8994 and #5904
point to some continued confusion w.r.t. attribute setting 'being' column setting
so if we now have
is an attribute set
it could be a column set
e.g. de-facto
df['C'] = 5
If someone actually wants an attribute to 'stick' around. (meaning they would have to intercept the
__finalize__
methods and actually deal with them properly, then I think it is reasonable to also have them add to the_internal_names
as well (see #8572)So basically would try to set a column (unless its an internal name).
(note that
getattr
is de-facto already equivalent to__getitem__
, e.g.df.B === df['B']
)(don't mind my JS equivalence notion :)
The text was updated successfully, but these errors were encountered: