(
self,
obj: Grouper | None = None,
freq: Frequency = "Min",
key: str | None = None,
closed: Literal["left", "right"] | None = None,
label: Literal["left", "right"] | None = None,
how: str = "mean",
fill_method=None,
limit: int | None = None,
convention: Literal["start", "end", "e", "s"] | None = None,
origin: (
Literal["epoch", "start", "start_day", "end", "end_day"]
| TimestampConvertibleTypes
) = "start_day",
offset: TimedeltaConvertibleTypes | None = None,
group_keys: bool = False,
**kwargs,
)
| 2383 | origin: TimeGrouperOrigin |
| 2384 | |
| 2385 | def __init__( |
| 2386 | self, |
| 2387 | obj: Grouper | None = None, |
| 2388 | freq: Frequency = "Min", |
| 2389 | key: str | None = None, |
| 2390 | closed: Literal["left", "right"] | None = None, |
| 2391 | label: Literal["left", "right"] | None = None, |
| 2392 | how: str = "mean", |
| 2393 | fill_method=None, |
| 2394 | limit: int | None = None, |
| 2395 | convention: Literal["start", "end", "e", "s"] | None = None, |
| 2396 | origin: ( |
| 2397 | Literal["epoch", "start", "start_day", "end", "end_day"] |
| 2398 | | TimestampConvertibleTypes |
| 2399 | ) = "start_day", |
| 2400 | offset: TimedeltaConvertibleTypes | None = None, |
| 2401 | group_keys: bool = False, |
| 2402 | **kwargs, |
| 2403 | ) -> None: |
| 2404 | # Check for correctness of the keyword arguments which would |
| 2405 | # otherwise silently use the default if misspelled |
| 2406 | if label not in {None, "left", "right"}: |
| 2407 | raise ValueError(f"Unsupported value {label} for `label`") |
| 2408 | if closed not in {None, "left", "right"}: |
| 2409 | raise ValueError(f"Unsupported value {closed} for `closed`") |
| 2410 | if convention not in {None, "start", "end", "e", "s"}: |
| 2411 | raise ValueError(f"Unsupported value {convention} for `convention`") |
| 2412 | |
| 2413 | if (key is None and obj is not None and isinstance(obj.index, PeriodIndex)) or ( # type: ignore[attr-defined] |
| 2414 | key is not None |
| 2415 | and obj is not None |
| 2416 | and getattr(obj[key], "dtype", None) == "period" # type: ignore[index] |
| 2417 | ): |
| 2418 | freq = to_offset(freq, is_period=True) |
| 2419 | else: |
| 2420 | freq = to_offset(freq) |
| 2421 | |
| 2422 | if not isinstance(freq, Tick): |
| 2423 | if offset is not None: |
| 2424 | warnings.warn( |
| 2425 | "The 'offset' keyword does not take effect when resampling " |
| 2426 | "with a 'freq' that is not Tick-like (h, m, s, ms, us, ns)", |
| 2427 | RuntimeWarning, |
| 2428 | stacklevel=find_stack_level(), |
| 2429 | ) |
| 2430 | if origin != "start_day": |
| 2431 | warnings.warn( |
| 2432 | "The 'origin' keyword does not take effect when resampling " |
| 2433 | "with a 'freq' that is not Tick-like (h, m, s, ms, us, ns)", |
| 2434 | RuntimeWarning, |
| 2435 | stacklevel=find_stack_level(), |
| 2436 | ) |
| 2437 | |
| 2438 | end_types = {"ME", "YE", "QE", "BME", "BYE", "BQE", "W"} |
| 2439 | rule = freq.rule_code |
| 2440 | if rule in end_types or ("-" in rule and rule[: rule.find("-")] in end_types): |
| 2441 | if closed is None: |
| 2442 | closed = "right" |
nothing calls this directly
no test coverage detected