|
22 | 22 | import numpy as np
|
23 | 23 |
|
24 | 24 | from pandas._libs.tslibs import Timestamp
|
25 |
| -from pandas._typing import NDFrameT |
| 25 | +from pandas._typing import ( |
| 26 | + NDFrameT, |
| 27 | + npt, |
| 28 | +) |
26 | 29 | from pandas.util._exceptions import find_stack_level
|
27 | 30 | from pandas.util._validators import validate_percentile
|
28 | 31 |
|
@@ -186,11 +189,9 @@ def _select_data(self):
|
186 | 189 | """Select columns to be described."""
|
187 | 190 | if (self.include is None) and (self.exclude is None):
|
188 | 191 | # when some numerics are found, keep only numerics
|
189 |
| - default_include = [np.number] |
| 192 | + default_include: list[npt.DTypeLike] = [np.number] |
190 | 193 | if self.datetime_is_numeric:
|
191 |
| - # error: Argument 1 to "append" of "list" has incompatible type "str"; |
192 |
| - # expected "Type[number[Any]]" |
193 |
| - default_include.append("datetime") # type: ignore[arg-type] |
| 194 | + default_include.append("datetime") |
194 | 195 | data = self.obj.select_dtypes(include=default_include)
|
195 | 196 | if len(data.columns) == 0:
|
196 | 197 | data = self.obj
|
@@ -230,10 +231,7 @@ def describe_numeric_1d(series: Series, percentiles: Sequence[float]) -> Series:
|
230 | 231 | """
|
231 | 232 | from pandas import Series
|
232 | 233 |
|
233 |
| - # error: Argument 1 to "format_percentiles" has incompatible type "Sequence[float]"; |
234 |
| - # expected "Union[ndarray, List[Union[int, float]], List[float], List[Union[str, |
235 |
| - # float]]]" |
236 |
| - formatted_percentiles = format_percentiles(percentiles) # type: ignore[arg-type] |
| 234 | + formatted_percentiles = format_percentiles(percentiles) |
237 | 235 |
|
238 | 236 | stat_index = ["count", "mean", "std", "min"] + formatted_percentiles + ["max"]
|
239 | 237 | d = (
|
@@ -337,10 +335,7 @@ def describe_timestamp_1d(data: Series, percentiles: Sequence[float]) -> Series:
|
337 | 335 | # GH-30164
|
338 | 336 | from pandas import Series
|
339 | 337 |
|
340 |
| - # error: Argument 1 to "format_percentiles" has incompatible type "Sequence[float]"; |
341 |
| - # expected "Union[ndarray, List[Union[int, float]], List[float], List[Union[str, |
342 |
| - # float]]]" |
343 |
| - formatted_percentiles = format_percentiles(percentiles) # type: ignore[arg-type] |
| 338 | + formatted_percentiles = format_percentiles(percentiles) |
344 | 339 |
|
345 | 340 | stat_index = ["count", "mean", "min"] + formatted_percentiles + ["max"]
|
346 | 341 | d = (
|
|
0 commit comments