It looks like that might be a bug to me. I filed an issue.
What's going on is it thinks that January is on the offset. I don't think this should be true, if the n
in the offset is supposed to work like you expect.
[~/]
[18]: from pandas.tseries.offsets import QuarterBegin
[~/]
[19]: ts = pd.Timestamp('2014-1-1')
[~/]
[20]: offset = QuarterBegin(2, startingMonth=4)
[~/]
[21]: offset.onOffset(ts)
[21]: True
You can get your expected output by doing this, but it's a hack, and I wouldn't expect it to work in the future. I'm not sure n
is working as it should (or we both misunderstand how it should work)
bad_case.resample('2Q-APR').shift(-1, freq='2QS-APR')