bug with empty df?

1,112 views
Skip to first unread message

Neal Becker

unread,
Oct 23, 2013, 9:27:04 AM10/23/13
to pydata
In [3]: from pandas import DataFrame, Series

In [4]: 
In [5]: df = DataFrame (np.zeros ((0,0)))

In [6]: df
Out[6]: 
Empty DataFrame
Columns: []
Index: []

In [7]: df.iloc[0] = Series (np.ones (4))

In [8]: df
Out[8]: 

Shouldn't this assignment have thrown an error?

Jeff

unread,
Oct 23, 2013, 9:45:05 AM10/23/13
to pyd...@googlegroups.com
In master this is correct

In [12]: df.iloc[0] = Series(np.ones(4))
IndexError: iloc cannot enlarge its target object

In [13]: df.loc[0] = Series(np.ones(4))
ValueError: cannot set a frame with no defined columns
Reply all
Reply to author
Forward
0 new messages