Skip to content

Commit b69b9d3

Browse files
committed
TST: period-like test for GH9012
1 parent c5af8e1 commit b69b9d3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

doc/source/whatsnew/v0.15.2.txt

+1
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,4 @@ Bug Fixes
271271
- Bug in plotting if sharex was enabled and index was a timeseries, would show labels on multiple axes (:issue:`3964`).
272272

273273
- Bug where passing a unit to the TimedeltaIndex constructor applied the to nano-second conversion twice. (:issue:`9011`).
274+
- Bug in plotting of a period-like array (:issue:`9012`)

pandas/tests/test_graphics.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
from datetime import datetime, date
1111

12-
from pandas import Series, DataFrame, MultiIndex, PeriodIndex, date_range
12+
from pandas import (Series, DataFrame, MultiIndex, PeriodIndex, date_range,
13+
bdate_range)
1314
from pandas.compat import (range, lrange, StringIO, lmap, lzip, u, zip,
1415
iteritems, OrderedDict, PY3)
1516
from pandas.util.decorators import cache_readonly
@@ -1152,6 +1153,18 @@ def test_xcompat(self):
11521153
self.assertNotIsInstance(lines[0].get_xdata(), PeriodIndex)
11531154
self.assertIsInstance(PeriodIndex(lines[0].get_xdata()), PeriodIndex)
11541155

1156+
def test_period_compat(self):
1157+
# GH 9012
1158+
# period-array conversions
1159+
df = DataFrame(
1160+
np.random.rand(21, 2),
1161+
index=bdate_range(datetime(2000, 1, 1), datetime(2000, 1, 31)),
1162+
columns=['a', 'b'])
1163+
1164+
df.plot()
1165+
self.plt.axhline(y=0)
1166+
tm.close()
1167+
11551168
def test_unsorted_index(self):
11561169
df = DataFrame({'y': np.arange(100)},
11571170
index=np.arange(99, -1, -1), dtype=np.int64)

0 commit comments

Comments
 (0)