Closed
Description
xref #10017 (comment)
This should raise like [5] below.
In [2]: df = DataFrame()
In [3]: df['foo'] = 1
In [4]: df
Out[4]:
Empty DataFrame
Columns: [foo]
Index: []
In [5]: DataFrame({'foo': 1})
ValueError: If using all scalar values, you must pass an index
I
n [17]: df.loc[1] = 1
\ValueError: cannot set a frame with no defined columns
Even though this is technically valid code (in [4]), IOW the scalar is reindexed to a 0-len index, this immediately loses information This should raise an error.