Skip to content

Commit 3357468

Browse files
committed
chore: remove mypy comment errors
1 parent 3085f9f commit 3357468

File tree

11 files changed

+17
-17
lines changed

11 files changed

+17
-17
lines changed

pandas/_typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
# numpy compatible types
8585
NumpyValueArrayLike: TypeAlias = ScalarLike_co | npt.ArrayLike
8686
# Name "npt._ArrayLikeInt_co" is not defined [name-defined]
87-
NumpySorter: TypeAlias = npt._ArrayLikeInt_co | None # type: ignore[name-defined]
87+
NumpySorter: TypeAlias = npt._ArrayLikeInt_co | None
8888

8989

9090
P = ParamSpec("P")

pandas/core/array_algos/quantile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def quantile_with_mask(
102102
interpolation=interpolation,
103103
)
104104

105-
result = np.asarray(result) # type: ignore[assignment]
105+
result = np.asarray(result)
106106
result = result.T
107107

108108
return result

pandas/core/arrays/arrow/_arrow_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def pyarrow_array_to_numpy_and_mask(
4444
mask = pyarrow.BooleanArray.from_buffers(
4545
pyarrow.bool_(), len(arr), [None, bitmask], offset=arr.offset
4646
)
47-
mask = np.asarray(mask) # type: ignore[assignment]
47+
mask = np.asarray(mask)
4848
else:
4949
mask = np.ones(len(arr), dtype=bool)
5050
return data, mask

pandas/core/arrays/arrow/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ def _box_pa_array(
657657
):
658658
arr_value = np.asarray(value, dtype=object)
659659
# similar to isna(value) but exclude NaN, NaT, nat-like, nan-like
660-
mask = is_pdna_or_none(arr_value) # type: ignore[assignment]
660+
mask = is_pdna_or_none(arr_value)
661661

662662
try:
663663
pa_array = pa.array(value, type=pa_type, mask=mask)
@@ -2738,7 +2738,7 @@ def _str_get_dummies(self, sep: str = "|", dtype: NpDtype | None = None):
27382738
dummies_dtype = np.bool_
27392739
dummies = np.zeros(n_rows * n_cols, dtype=dummies_dtype)
27402740
dummies[indices] = True
2741-
dummies = dummies.reshape((n_rows, n_cols)) # type: ignore[assignment]
2741+
dummies = dummies.reshape((n_rows, n_cols))
27422742
result = self._from_pyarrow_array(pa.array(list(dummies)))
27432743
return result, uniques_sorted.to_pylist()
27442744

pandas/core/arrays/categorical.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ def value_counts(self, dropna: bool = True) -> Series:
18691869
count = np.bincount(obs, minlength=ncat or 0)
18701870
else:
18711871
count = np.bincount(np.where(mask, code, ncat))
1872-
ix = np.append(ix, -1) # type: ignore[assignment]
1872+
ix = np.append(ix, -1)
18731873

18741874
ix = coerce_indexer_dtype(ix, self.dtype.categories)
18751875
ix_categorical = self._from_backing_data(ix)

pandas/core/arrays/string_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ def _cast_pointwise_result(self, values) -> ArrayLike:
764764
result = super()._cast_pointwise_result(values)
765765
if isinstance(result.dtype, StringDtype):
766766
# Ensure we retain our same na_value/storage
767-
result = result.astype(self.dtype) # type: ignore[call-overload]
767+
result = result.astype(self.dtype)
768768
return result
769769

770770
@classmethod

pandas/core/groupby/groupby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,7 @@ def _apply_filter(self, indices, dropna):
18861886
mask.fill(False)
18871887
mask[indices.astype(int)] = True
18881888
# mask fails to broadcast when passed to where; broadcast manually.
1889-
mask = np.tile(mask, list(self._selected_obj.shape[1:]) + [1]).T # type: ignore[assignment]
1889+
mask = np.tile(mask, list(self._selected_obj.shape[1:]) + [1]).T
18901890
filtered = self._selected_obj.where(mask) # Fill with NaNs.
18911891
return filtered
18921892

pandas/core/indexers/objects.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ def get_window_bounds(
131131
if closed in ["left", "neither"]:
132132
end -= 1
133133

134-
end = np.clip(end, 0, num_values) # type: ignore[assignment]
135-
start = np.clip(start, 0, num_values) # type: ignore[assignment]
134+
end = np.clip(end, 0, num_values)
135+
start = np.clip(start, 0, num_values)
136136

137137
return start, end
138138

@@ -402,7 +402,7 @@ def get_window_bounds(
402402
start = np.arange(0, num_values, step, dtype="int64")
403403
end = start + self.window_size
404404
if self.window_size:
405-
end = np.clip(end, 0, num_values) # type: ignore[assignment]
405+
end = np.clip(end, 0, num_values)
406406

407407
return start, end
408408

@@ -488,7 +488,7 @@ def get_window_bounds(
488488
)
489489
window_indices_start += len(indices)
490490
# Extend as we'll be slicing window like [start, end)
491-
window_indices = np.append(window_indices, [window_indices[-1] + 1]).astype( # type: ignore[assignment]
491+
window_indices = np.append(window_indices, [window_indices[-1] + 1]).astype(
492492
np.int64, copy=False
493493
)
494494
start_arrays.append(window_indices.take(ensure_platform_int(start)))

pandas/core/nanops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ def _mask_datetimelike_result(
653653
axis_mask = mask.any(axis=axis)
654654
# error: Unsupported target for indexed assignment ("Union[ndarray[Any, Any],
655655
# datetime64, timedelta64]")
656-
result[axis_mask] = iNaT # type: ignore[index]
656+
result[axis_mask] = iNaT
657657
else:
658658
if mask.any():
659659
return np.int64(iNaT).view(orig_values.dtype)

pandas/core/reshape/encoding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def get_empty_frame(data) -> DataFrame:
359359

360360
if drop_first:
361361
# remove first GH12042
362-
dummy_mat = dummy_mat[:, 1:] # type: ignore[assignment]
362+
dummy_mat = dummy_mat[:, 1:]
363363
dummy_cols = dummy_cols[1:]
364364
return DataFrame(dummy_mat, index=index, columns=dummy_cols, dtype=_dtype)
365365

0 commit comments

Comments
 (0)