(
binner: PeriodIndex, bins: np.ndarray, labels: PeriodIndex, nat_count: int
)
| 2975 | |
| 2976 | |
| 2977 | def _insert_nat_bin( |
| 2978 | binner: PeriodIndex, bins: np.ndarray, labels: PeriodIndex, nat_count: int |
| 2979 | ) -> tuple[PeriodIndex, np.ndarray, PeriodIndex]: |
| 2980 | # NaT handling as in pandas._lib.lib.generate_bins_dt64() |
| 2981 | # shift bins by the number of NaT |
| 2982 | assert nat_count > 0 |
| 2983 | bins += nat_count |
| 2984 | bins = np.insert(bins, 0, nat_count) |
| 2985 | |
| 2986 | # Incompatible types in assignment (expression has type "Index", variable |
| 2987 | # has type "PeriodIndex") |
| 2988 | binner = binner.insert(0, NaT) # type: ignore[assignment] |
| 2989 | # Incompatible types in assignment (expression has type "Index", variable |
| 2990 | # has type "PeriodIndex") |
| 2991 | labels = labels.insert(0, NaT) # type: ignore[assignment] |
| 2992 | return binner, bins, labels |
| 2993 | |
| 2994 | |
| 2995 | def _adjust_dates_anchored( |
no test coverage detected