-
-
Notifications
You must be signed in to change notification settings - Fork 141
Timestamp -> datetime and Timedelta -> timedelta #841
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,7 @@ from collections.abc import ( | |
MutableMapping, | ||
Sequence, | ||
) | ||
import datetime | ||
import datetime as _dt | ||
import datetime as dt | ||
from re import Pattern | ||
from typing import ( | ||
Any, | ||
|
@@ -373,7 +372,7 @@ class DataFrame(NDFrame, OpsMixin): | |
convert_dates: dict[HashableT1, StataDateFormat] | None = ..., | ||
write_index: _bool = ..., | ||
byteorder: Literal["<", ">", "little", "big"] | None = ..., | ||
time_stamp: _dt.datetime | None = ..., | ||
time_stamp: dt.datetime | None = ..., | ||
data_label: _str | None = ..., | ||
variable_labels: dict[HashableT2, str] | None = ..., | ||
version: Literal[114, 117, 118, 119] | None = ..., | ||
|
@@ -1565,14 +1564,14 @@ class DataFrame(NDFrame, OpsMixin): | |
) -> DataFrame: ... | ||
def at_time( | ||
self, | ||
time: _str | datetime.time, | ||
time: _str | dt.time, | ||
asof: _bool = ..., | ||
axis: Axis | None = ..., | ||
) -> DataFrame: ... | ||
def between_time( | ||
self, | ||
start_time: _str | datetime.time, | ||
end_time: _str | datetime.time, | ||
start_time: _str | dt.time, | ||
end_time: _str | dt.time, | ||
axis: Axis | None = ..., | ||
) -> DataFrame: ... | ||
@overload | ||
|
@@ -1941,7 +1940,7 @@ class DataFrame(NDFrame, OpsMixin): | |
level: Level | None = ..., | ||
origin: Timestamp | ||
| Literal["epoch", "start", "start_day", "end", "end_day"] = ..., | ||
offset: Timedelta | _str | None = ..., | ||
offset: dt.timedelta | _str | None = ..., | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put back |
||
group_keys: _bool = ..., | ||
) -> Resampler[DataFrame]: ... | ||
def rfloordiv( | ||
|
@@ -1968,7 +1967,7 @@ class DataFrame(NDFrame, OpsMixin): | |
@overload | ||
def rolling( | ||
self, | ||
window: int | str | _dt.timedelta | BaseOffset | BaseIndexer, | ||
window: int | str | dt.timedelta | BaseOffset | BaseIndexer, | ||
min_periods: int | None = ..., | ||
center: _bool = ..., | ||
on: Hashable | None = ..., | ||
|
@@ -1982,7 +1981,7 @@ class DataFrame(NDFrame, OpsMixin): | |
@overload | ||
def rolling( | ||
self, | ||
window: int | str | _dt.timedelta | BaseOffset | BaseIndexer, | ||
window: int | str | dt.timedelta | BaseOffset | BaseIndexer, | ||
min_periods: int | None = ..., | ||
center: _bool = ..., | ||
on: Hashable | None = ..., | ||
|
@@ -2217,8 +2216,8 @@ class DataFrame(NDFrame, OpsMixin): | |
) -> DataFrame: ... | ||
def truncate( | ||
self, | ||
before: datetime.date | _str | int | None = ..., | ||
after: datetime.date | _str | int | None = ..., | ||
before: dt.date | _str | int | None = ..., | ||
after: dt.date | _str | int | None = ..., | ||
axis: Axis | None = ..., | ||
copy: _bool = ..., | ||
) -> DataFrame: ... | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import datetime as dt | ||
from datetime import tzinfo | ||
from datetime import ( | ||
timedelta, | ||
tzinfo, | ||
) | ||
from typing import ( | ||
Generic, | ||
Literal, | ||
|
@@ -166,21 +169,21 @@ class _DatetimeRoundingMethods(Generic[_DTRoundingMethodReturnType]): | |
freq: str | BaseOffset | None, | ||
ambiguous: Literal["raise", "infer", "NaT"] | np_ndarray_bool = ..., | ||
nonexistent: Literal["shift_forward", "shift_backward", "NaT", "raise"] | ||
| Timedelta = ..., | ||
| timedelta = ..., | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put back |
||
) -> _DTRoundingMethodReturnType: ... | ||
def floor( | ||
self, | ||
freq: str | BaseOffset | None, | ||
ambiguous: Literal["raise", "infer", "NaT"] | np_ndarray_bool = ..., | ||
nonexistent: Literal["shift_forward", "shift_backward", "NaT", "raise"] | ||
| Timedelta = ..., | ||
| timedelta = ..., | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put back |
||
) -> _DTRoundingMethodReturnType: ... | ||
def ceil( | ||
self, | ||
freq: str | BaseOffset | None, | ||
ambiguous: Literal["raise", "infer", "NaT"] | np_ndarray_bool = ..., | ||
nonexistent: Literal["shift_forward", "shift_backward", "NaT", "raise"] | ||
| Timedelta = ..., | ||
| timedelta = ..., | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put back |
||
) -> _DTRoundingMethodReturnType: ... | ||
|
||
_DTNormalizeReturnType = TypeVar( | ||
|
@@ -206,7 +209,7 @@ class _DatetimeLikeNoTZMethods( | |
tz: tzinfo | str | None, | ||
ambiguous: Literal["raise", "infer", "NaT"] | np_ndarray_bool = ..., | ||
nonexistent: Literal["shift_forward", "shift_backward", "NaT", "raise"] | ||
| Timedelta = ..., | ||
| timedelta = ..., | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put back |
||
) -> _DTNormalizeReturnType: ... | ||
def tz_convert(self, tz: tzinfo | str | None) -> _DTNormalizeReturnType: ... | ||
def normalize(self) -> _DTNormalizeReturnType: ... | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ from collections.abc import ( | |
Sequence, | ||
) | ||
from datetime import ( | ||
datetime, | ||
timedelta, | ||
tzinfo, | ||
) | ||
|
@@ -15,7 +16,6 @@ import numpy as np | |
from pandas import ( | ||
DataFrame, | ||
Index, | ||
Timedelta, | ||
TimedeltaIndex, | ||
Timestamp, | ||
) | ||
|
@@ -59,13 +59,13 @@ class DatetimeIndex(DatetimeTimedeltaMixin[Timestamp], DatetimeIndexProperties): | |
@overload | ||
def __add__(self, other: TimedeltaSeries) -> TimestampSeries: ... | ||
@overload | ||
def __add__(self, other: Timedelta | TimedeltaIndex) -> DatetimeIndex: ... | ||
def __add__(self, other: timedelta | TimedeltaIndex) -> DatetimeIndex: ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put back |
||
@overload | ||
def __sub__(self, other: TimedeltaSeries) -> TimestampSeries: ... | ||
@overload | ||
def __sub__(self, other: Timedelta | TimedeltaIndex) -> DatetimeIndex: ... | ||
def __sub__(self, other: timedelta | TimedeltaIndex) -> DatetimeIndex: ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put back |
||
@overload | ||
def __sub__(self, other: Timestamp | DatetimeIndex) -> TimedeltaIndex: ... | ||
def __sub__(self, other: datetime | DatetimeIndex) -> TimedeltaIndex: ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put back |
||
def to_series(self, index=..., name=...) -> TimestampSeries: ... | ||
def snap(self, freq: str = ...): ... | ||
def get_value(self, series, key): ... | ||
|
@@ -90,7 +90,7 @@ def date_range( | |
start: str | DateAndDatetimeLike | None = ..., | ||
end: str | DateAndDatetimeLike | None = ..., | ||
periods: int | None = ..., | ||
freq: str | timedelta | Timedelta | BaseOffset = ..., | ||
freq: str | timedelta | BaseOffset = ..., | ||
tz: str | tzinfo = ..., | ||
normalize: bool = ..., | ||
name: Hashable | None = ..., | ||
|
@@ -102,7 +102,7 @@ def bdate_range( | |
start: str | DateAndDatetimeLike | None = ..., | ||
end: str | DateAndDatetimeLike | None = ..., | ||
periods: int | None = ..., | ||
freq: str | timedelta | Timedelta | BaseOffset = ..., | ||
freq: str | timedelta | BaseOffset = ..., | ||
tz: str | tzinfo = ..., | ||
normalize: bool = ..., | ||
name: Hashable | None = ..., | ||
|
@@ -116,7 +116,7 @@ def bdate_range( | |
end: str | DateAndDatetimeLike | None = ..., | ||
periods: int | None = ..., | ||
*, | ||
freq: str | timedelta | Timedelta | BaseOffset, | ||
freq: str | timedelta | BaseOffset, | ||
tz: str | tzinfo = ..., | ||
normalize: bool = ..., | ||
name: Hashable | None = ..., | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put back
Timestamp