Skip to content

Commit

Permalink
BUG: fix PeriodConverter issue when given a list of integers (GH9012)
Browse files Browse the repository at this point in the history
For example coming up when [0, 1] is passed by axhline

Restore old behaviour, but special case arrays of Periods to keep the
performance gain of using PeriodIndex instead of get_datevalue for that case.
  • Loading branch information
jorisvandenbossche authored and jreback committed Dec 11, 2014
1 parent 39048f6 commit c5af8e1
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit c5af8e1

Please sign in to comment.