Skip to content
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

PERF: Speeds up creation of Period, PeriodArray, with Offset freq #23589

Merged
merged 3 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ cdef to_offset(object obj):
Wrap pandas.tseries.frequencies.to_offset to keep centralize runtime
imports
"""
if isinstance(obj, _BaseOffset):
return obj
from pandas.tseries.frequencies import to_offset
return to_offset(obj)

Expand Down
1 change: 0 additions & 1 deletion pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,6 @@ cdef class _Period(object):

@classmethod
def _maybe_convert_freq(cls, object freq):

if isinstance(freq, (int, tuple)):
code, stride = get_freq_code(freq)
freq = get_freq_str(code, stride)
Expand Down