Skip to content

BUG: fix PeriodConverter issue when given a list of integers (GH9012) #9050

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

Closed
Closed
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
4 changes: 3 additions & 1 deletion pandas/tseries/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ def convert(values, units, axis):
return values.asfreq(axis.freq).values
if isinstance(values, Index):
return values.map(lambda x: get_datevalue(x, axis.freq))
if isinstance(values, (list, tuple, np.ndarray, Index)):
if com.is_period_arraylike(values):
return PeriodIndex(values, freq=axis.freq).values
if isinstance(values, (list, tuple, np.ndarray, Index)):
return [get_datevalue(x, axis.freq) for x in values]
return values


Expand Down