|
60 | 60 | is_iterator, |
61 | 61 | is_sequence, |
62 | 62 | is_named_tuple) |
| 63 | +from pandas.core.dtypes.concat import _get_sliced_frame_result_type |
63 | 64 | from pandas.core.dtypes.missing import isna, notna |
64 | 65 |
|
65 | 66 |
|
@@ -2166,8 +2167,7 @@ def _ixs(self, i, axis=0): |
2166 | 2167 |
|
2167 | 2168 | if index_len and not len(values): |
2168 | 2169 | values = np.array([np.nan] * index_len, dtype=object) |
2169 | | - result = self._constructor_sliced._from_array( |
2170 | | - values, index=self.index, name=label, fastpath=True) |
| 2170 | + result = self._box_col_values(values, label) |
2171 | 2171 |
|
2172 | 2172 | # this is a cached value, mark it so |
2173 | 2173 | result._set_as_cached(label, self) |
@@ -2563,8 +2563,8 @@ def _box_item_values(self, key, values): |
2563 | 2563 |
|
2564 | 2564 | def _box_col_values(self, values, items): |
2565 | 2565 | """ provide boxed values for a column """ |
2566 | | - return self._constructor_sliced._from_array(values, index=self.index, |
2567 | | - name=items, fastpath=True) |
| 2566 | + klass = _get_sliced_frame_result_type(values, self) |
| 2567 | + return klass(values, index=self.index, name=items, fastpath=True) |
2568 | 2568 |
|
2569 | 2569 | def __setitem__(self, key, value): |
2570 | 2570 | key = com._apply_if_callable(key, self) |
|
0 commit comments