MCPcopy
hub / github.com/pandas-dev/pandas / _insert_nat_bin

Function _insert_nat_bin

pandas/core/resample.py:2977–2992  ·  view source on GitHub ↗
(
    binner: PeriodIndex, bins: np.ndarray, labels: PeriodIndex, nat_count: int
)

Source from the content-addressed store, hash-verified

2975
2976
2977def _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
2995def _adjust_dates_anchored(

Callers 1

_get_period_binsMethod · 0.85

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected