File tree 1 file changed +11
-11
lines changed
1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -2475,20 +2475,20 @@ def _ensure_valid_index(self, value):
2475
2475
"""
2476
2476
# GH5632, make sure that we are a Series convertible
2477
2477
if not len (self .index ):
2478
- if is_list_like (value ):
2479
- try :
2480
- value = Series (value )
2481
- except :
2482
- raise ValueError ('Cannot set a frame with no defined'
2483
- 'index and a value that cannot be '
2484
- 'converted to a Series' )
2485
-
2486
- self ._data = self ._data .reindex_axis (value .index .copy (), axis = 1 ,
2487
- fill_value = np .nan )
2488
- else :
2478
+ if not is_list_like (value ):
2489
2479
# GH16823, Raise an error due to loss of information
2490
2480
raise ValueError ('If using all scalar values, you must pass'
2491
2481
' an index' )
2482
+ try :
2483
+ value = Series (value )
2484
+ except :
2485
+ raise ValueError ('Cannot set a frame with no defined'
2486
+ 'index and a value that cannot be '
2487
+ 'converted to a Series' )
2488
+
2489
+ self ._data = self ._data .reindex_axis (value .index .copy (), axis = 1 ,
2490
+ fill_value = np .nan )
2491
+
2492
2492
2493
2493
def _set_item (self , key , value ):
2494
2494
"""
You can’t perform that action at this time.
0 commit comments