|
118 | 118 | from pandas.core.arrays._mixins import NDArrayBackedExtensionArray
|
119 | 119 |
|
120 | 120 | # comparison is faster than is_object_dtype
|
121 |
| - |
122 |
| -# error: Value of type variable "_DTypeScalar" of "dtype" cannot be "object" |
123 |
| -_dtype_obj = np.dtype(object) # type: ignore[type-var] |
| 121 | +_dtype_obj = np.dtype("object") |
124 | 122 |
|
125 | 123 |
|
126 | 124 | class Block(PandasObject):
|
@@ -835,7 +833,7 @@ def _replace_list(
|
835 | 833 |
|
836 | 834 | rb = [self if inplace else self.copy()]
|
837 | 835 | for i, (src, dest) in enumerate(pairs):
|
838 |
| - new_rb: List[Block] = [] |
| 836 | + new_rb: List["Block"] = [] |
839 | 837 | for blk in rb:
|
840 | 838 | m = masks[i]
|
841 | 839 | convert = i == src_len # only convert once at the end
|
@@ -1598,14 +1596,9 @@ def to_native_types(self, na_rep="nan", quoting=None, **kwargs):
|
1598 | 1596 | values = self.values
|
1599 | 1597 | mask = isna(values)
|
1600 | 1598 |
|
1601 |
| - # error: Incompatible types in assignment (expression has type "ndarray", |
1602 |
| - # variable has type "ExtensionArray") |
1603 |
| - values = np.asarray(values.astype(object)) # type: ignore[assignment] |
1604 |
| - values[mask] = na_rep |
1605 |
| - |
1606 |
| - # TODO(EA2D): reshape not needed with 2D EAs |
1607 |
| - # we are expected to return a 2-d ndarray |
1608 |
| - return self.make_block(values) |
| 1599 | + new_values = np.asarray(values.astype(object)) |
| 1600 | + new_values[mask] = na_rep |
| 1601 | + return self.make_block(new_values) |
1609 | 1602 |
|
1610 | 1603 | def take_nd(
|
1611 | 1604 | self, indexer, axis: int = 0, new_mgr_locs=None, fill_value=lib.no_default
|
|
0 commit comments