python - Wrong result for pandas timestamp - dateoffset -


strangely enough:

in[]:  import pandas pd        pd.timestamp('2015-10-10') - pd.dateoffset(month=1) out[]: timestamp('2015-01-10 00:00:00') 

what doing wrong?

ps:

pd.show_versions()  installed versions ------------------ commit: none python: 2.7.10.final.0 python-bits: 64 os: linux os-release: 3.13.0-63-generic machine: x86_64 processor: x86_64 byteorder: little lc_all: none lang: en_us.utf-8  pandas: 0.16.2 nose: 1.3.7 cython: 0.23.3 numpy: 1.9.2 scipy: 0.16.0 statsmodels: 0.6.1 ipython: 4.0.0 sphinx: 1.3.1 patsy: 0.3.0 dateutil: 2.4.2 pytz: 2015.4 bottleneck: 1.0.0 tables: 3.2.0 numexpr: 2.4.3 matplotlib: 1.4.3 openpyxl: 1.8.5 xlrd: 0.9.3 xlwt: 1.0.0 xlsxwriter: 0.7.3 lxml: 3.4.4 bs4: 4.3.2 html5lib: none httplib2: none apiclient: none sqlalchemy: 1.0.5 pymysql: none psycopg2: none 

you want this:

>>> pd.timestamp('2015-10-10') - pd.dateoffset(month=9) timestamp('2015-09-10 00:00:00', tz=none) 

this may better though:

>>> pd.timestamp('2015-10-10') - pd.dateoffset(months=1) timestamp('2015-09-10 00:00:00', tz=none) 

you're setting month want set months. minute difference.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -