Skip to content

Conversation

@jreback
Copy link
Contributor

@jreback jreback commented Dec 19, 2013

 allow assignment of a column in a frame with a scalar with no index (so adds to the columns),
 instead of raising; this preservers 0.12 behavior

related #5720, #5744

going back to 0.12 behavior
effectively can add a column by assigning a scalar to a frame that doesn't have an index
need a more compelling reason to raise here

In [4]: df = DataFrame({"A": [1, 2, 3], "B": [1.2, 4.2, 5.2]})

In [5]: y = df[df.A > 5]

In [6]: y
Out[6]: 
Empty DataFrame
Columns: [A, B]
Index: []

[0 rows x 2 columns]

In [7]: y['New'] = np.nan

In [8]: y
Out[8]: 
Empty DataFrame
Columns: [A, B, New]
Index: []

[0 rows x 3 columns]

     allow assignment of a column in a frame with a scalar with no index (so adds to the columns),
     instead of raising; this preservers 0.12 behavior
jreback added a commit that referenced this pull request Dec 19, 2013
API/REGRESS: partial revert of f8b6208 (GH5720,GH5744)
@jreback jreback merged commit 8ce7687 into pandas-dev:master Dec 19, 2013
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.

1 participant