8000 DEPR: Timestamp.freq by jbrockmendel · Pull Request #41586 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

DEPR: Timestamp.freq #41586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
mypy fixup
  • Loading branch information
jbrockmendel committed Jun 2, 2021
commit 069ae4c0e5a8e8abc1bdcaf6c84ec8df9bac94e7
3 changes: 3 additions & 0 deletions pandas/_libs/tslibs/timestamps.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ from typing import (
import numpy as np

from pandas._libs.tslibs import (
BaseOffset,
NaT,
NaTType,
Period,
Expand Down Expand Up @@ -57,6 +58,8 @@ class Timestamp(datetime):
fold: int | None= ...,
) -> _S | NaTType: ...

def _set_freq(self, freq: BaseOffset | None) -> None: ...

@property
def year(self) -> int: ...
@property
Expand Down
4 changes: 3 additions & 1 deletion pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,9 @@ def _check_compatible_with(self, other, setitem: bool = False):

def _box_func(self, x) -> Timestamp | NaTType:
ts = Timestamp(x, tz=self.tz)
if ts is not NaT:
# Non-overlapping identity check (left operand type: "Timestamp",
# right operand type: "NaTType")
if ts is not NaT: # type: ignore[comparison-overlap]
# GH#41586
# do this instead of passing to the constructor to avoid FutureWarning
ts._set_freq(self.freq)
Expand Down
0