Feature Request: Allow new column setting via attribute assignment #11848
Labels
API Design
Duplicate Report
Duplicate issue or pull request
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
One "gotcha" in pandas that's always bugged me is that you can generally access and change columns in a DataFrame by dot-messaging (attribute assignment) except for adding new columns. For example, one can play with existing columns easily:
But you can't set new columns:
Seems like it wouldn't be hard to modify
__setattr__
so that if the setting value is a Series, NumPy Array, or scalar value, just calldf[key] = value
.Seem reasonable?
(Still wrestling with copy-on-write PR, but happy to come back to this if others support and no on addresses till then)
The text was updated successfully, but these errors were encountered: