Skip to content

Commit 3e4c572

Browse files
scarijreback
authored andcommitted
BUG: Series.plot() doesn't work with CustomBusinessDay frequency
Closes #7222 Missing freqstr 'C' in `_period_code_map` Author: Younggun Kim <[email protected]> Closes #12294 from scari/master and squashes the following commits: 83ca60f [Younggun Kim] BUG: Series.plot() doesn't work with CustomBusinessDay frequency
1 parent 3256b57 commit 3e4c572

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

doc/source/whatsnew/v0.18.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,7 @@ Bug Fixes
951951

952952

953953
- Bug in ``.plot`` potentially modifying the ``colors`` input when the number of columns didn't match the number of series provided (:issue:`12039`).
954+
- Bug in ``Series.plot`` failing when index has a ``CustomBusinessDay`` frequency (:issue:`7222`).
954955

955956
- Bug in ``read_excel`` failing to read data with one column when ``squeeze=True`` (:issue:`12157`)
956957
- Bug in ``.groupby`` where a ``KeyError`` was not raised for a wrong column if there was only one row in the dataframe (:issue:`11741`)

pandas/tests/test_graphics.py

+9
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,15 @@ def test_xticklabels(self):
12701270
exp = ['P%02d' % i for i in [0, 3, 5, 9]]
12711271
self._check_text_labels(ax.get_xticklabels(), exp)
12721272

1273+
def test_custom_business_day_freq(self):
1274+
# GH7222
1275+
from pandas.tseries.offsets import CustomBusinessDay
1276+
s = Series(range(100, 121), index=pd.bdate_range(
1277+
start='2014-05-01', end='2014-06-01',
1278+
freq=CustomBusinessDay(holidays=['2014-05-26'])))
1279+
1280+
_check_plot_works(s.plot)
1281+
12731282

12741283
@tm.mplskip
12751284
class TestDataFramePlots(TestPlotBase):

pandas/tseries/frequencies.py

+1
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ def get_standard_freq(freq):
671671
"Q": 2000, # Quarterly - December year end (default quarterly)
672672
"A": 1000, # Annual
673673
"W": 4000, # Weekly
674+
"C": 5000, # Custom Business Day
674675
})
675676

676677

0 commit comments

Comments
 (0)