Skip to content

Commit 9013d62

Browse files
committed
add to to_offset a boolean argument is_period II
1 parent b1bb12a commit 9013d62

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

pandas/_libs/tslibs/offsets.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from numpy cimport int64_t
22

33

4-
cpdef to_offset(object obj, is_period=*)
4+
cpdef to_offset(object obj)
55
cdef bint is_offset_object(object obj)
66
cdef bint is_tick_object(object obj)
77

pandas/_libs/tslibs/offsets.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4157,7 +4157,7 @@ def _get_offset(name: str) -> BaseOffset:
41574157
return _offset_map[name]
41584158

41594159

4160-
cpdef to_offset(freq, is_period=False):
4160+
cpdef to_offset(freq, is_period=None):
41614161
"""
41624162
Return DateOffset object from string or datetime.timedelta object.
41634163

pandas/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ def rand_series_with_duplicate_datetimeindex() -> Series:
919919
params=[
920920
(Interval(left=0, right=5), IntervalDtype("int64", "right")),
921921
(Interval(left=0.1, right=0.5), IntervalDtype("float64", "right")),
922-
(Period("2012-01", freq="ME"), "period[ME]"),
922+
(Period("2012-01", freq="M"), "period[M]"),
923923
(Period("2012-02-01", freq="D"), "period[D]"),
924924
(
925925
Timestamp("2011-01-01", tz="US/Eastern"),

pandas/core/arrays/period.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ def __init__(
213213
dtype: Dtype | None = None,
214214
freq=None,
215215
copy: bool = False,
216-
is_period: bool = True,
217216
) -> None:
217+
is_period = True
218218
freq = validate_dtype_freq(dtype, freq, is_period)
219219

220220
if freq is not None:

pandas/core/indexes/period.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ def __new__(
211211
dtype: Dtype | None = None,
212212
copy: bool = False,
213213
name: Hashable = None,
214-
is_period: bool = True,
215214
**fields,
216215
) -> PeriodIndex:
217216
valid_field_set = {
@@ -224,6 +223,7 @@ def __new__(
224223
"second",
225224
}
226225

226+
is_period = True
227227
refs = None
228228
if not copy and isinstance(data, (Index, ABCSeries)):
229229
refs = data._references

0 commit comments

Comments
 (0)