diff --git a/pandas/core/ops/array_ops.py b/pandas/core/ops/array_ops.py index 1584c16fd4961..84b8ce6bdcb31 100644 --- a/pandas/core/ops/array_ops.py +++ b/pandas/core/ops/array_ops.py @@ -5,10 +5,7 @@ import datetime from functools import partial import operator -from typing import ( - Any, - cast, -) +from typing import Any import numpy as np @@ -94,8 +91,6 @@ def _masked_arith_op(x: np.ndarray, y, op): assert isinstance(x, np.ndarray), type(x) if isinstance(y, np.ndarray): dtype = find_common_type([x.dtype, y.dtype]) - # x and y are both ndarrays -> common_dtype is np.dtype - dtype = cast(np.dtype, dtype) result = np.empty(x.size, dtype=dtype) if len(x) != len(y): diff --git a/pandas/io/stata.py b/pandas/io/stata.py index 36da908dd6cdc..451ab170e149d 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -1698,13 +1698,13 @@ def read( data = DataFrame(columns=self.varlist) else: data = DataFrame.from_records(raw_data) - data.columns = self.varlist + data.columns = Index(self.varlist) # If index is not specified, use actual row number rather than # restarting at 0 for each chunk. if index_col is None: - ix = np.arange(self._lines_read - read_lines, self._lines_read) - data.index = ix # set attr instead of set_index to avoid copy + rng = np.arange(self._lines_read - read_lines, self._lines_read) + data.index = Index(rng) # set attr instead of set_index to avoid copy if columns is not None: try: