pandas: QuarterBegin wrong date

Would expect this to point to one of (1, 4, 7, 10)…

#### Code Sample, a copy-pastable example if possible
import pandas as pd
pd.Timestamp.today() - pd.tseries.offsets.QuarterBegin()
>Timestamp('2016-09-01 15:29:06.556269')

#### Expected Output
Timestamp('2016-07-01 15:29:06.556269')

#### output of ``pd.show_versions()``
In [4]: pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Darwin
OS-release: 15.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 25.1.6
Cython: None
numpy: 1.11.1
scipy: None
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: 3.2.3.1
numexpr: 2.6.1
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.13
pymysql: None
psycopg2: 2.6.2 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: None
pandas_datareader: None

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

The default anchor month for QuarterBegin is 3 (6, 9, 12). It sounds like you want it anchored at 1, if so, use the startingMonth keyword arg. Docs could be better here.

qtr = pd.tseries.offsets.QuarterBegin(startingMonth=1)

pd.Timestamp.today() - qtr
Out[13]: Timestamp('2016-07-01 16:06:23.581744')