-
-
Notifications
You must be signed in to change notification settings - Fork 143
period_range and Period should accept date, datetime and pd.Timestamp #728
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 3 commits
c72dbc7
99970d4
ee46a6b
8c56364
d47c803
52719fb
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 |
---|---|---|
|
@@ -851,7 +851,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): | |
@overload | ||
def apply( | ||
self, | ||
func: Callable[..., Scalar | Sequence | set | Mapping | None], | ||
func: Callable[..., Scalar | Sequence | set | Mapping | NAType | 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. I think this change came up because you haven't merged with |
||
convertDType: _bool = ..., | ||
args: tuple = ..., | ||
**kwds, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
) | ||
import xarray as xr | ||
|
||
from pandas._libs.missing import NAType | ||
from pandas._libs.tslibs.timedeltas import Timedelta | ||
from pandas._libs.tslibs.timestamps import Timestamp | ||
from pandas._typing import ( | ||
|
@@ -470,6 +471,8 @@ def get_depth(url: str) -> int: | |
ss = s.astype(str) | ||
check(assert_type(ss.apply(get_depth), pd.Series), pd.Series, np.int64) | ||
|
||
check(assert_type(s.apply(lambda x: pd.NA), pd.Series), pd.Series, NAType) | ||
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. same comment as above - this change is already in |
||
|
||
|
||
def test_types_element_wise_arithmetic() -> None: | ||
s = pd.Series([0, 1, -10]) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -838,6 +838,27 @@ def test_period_range() -> None: | |
), | ||
pd.PeriodIndex, | ||
) | ||
check( | ||
assert_type( | ||
pd.period_range(pd.Timestamp("2001-01-01"), end="2002-01-01", freq="Q"), | ||
pd.PeriodIndex, | ||
), | ||
pd.PeriodIndex, | ||
) | ||
check( | ||
assert_type( | ||
pd.period_range(dt.datetime(2001, 1, 1), end="2002-01-01", freq="Q"), | ||
pd.PeriodIndex, | ||
), | ||
pd.PeriodIndex, | ||
) | ||
check( | ||
assert_type( | ||
pd.period_range(dt.date(2001, 1, 1), end="2002-01-01", freq="Q"), | ||
pd.PeriodIndex, | ||
), | ||
pd.PeriodIndex, | ||
) | ||
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. For these tests, you should also change the 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. Done |
||
|
||
|
||
def test_to_datetime_scalar() -> None: | ||
|
Uh oh!
There was an error while loading. Please reload this page.