Loffset doesn't work when resampling with count() · Issue #12725 · pandas-dev/pandas (original) (raw)
The label offset loffset
has no effect when resampling a Series using .count()
:
>>> import pandas as pd
>>> import numpy as np
>>> rng = pd.date_range('1/1/2012', periods=100, freq='S')
>>> ts = pd.Series(np.ones(len(rng)), index=rng)
>>> ts.resample('10S', loffset='1s').mean() #Works as expected, labels are offset by 1s
2012-01-01 00:00:01 1.0
2012-01-01 00:00:11 1.0
2012-01-01 00:00:21 1.0
2012-01-01 00:00:31 1.0
2012-01-01 00:00:41 1.0
2012-01-01 00:00:51 1.0
2012-01-01 00:01:01 1.0
2012-01-01 00:01:11 1.0
2012-01-01 00:01:21 1.0
2012-01-01 00:01:31 1.0
Freq: 10S, dtype: float64
>>> ts.resample('10S', loffset='1s').count() #loffset has no effect
2012-01-01 00:00:00 10
2012-01-01 00:00:10 10
2012-01-01 00:00:20 10
2012-01-01 00:00:30 10
2012-01-01 00:00:40 10
2012-01-01 00:00:50 10
2012-01-01 00:01:00 10
2012-01-01 00:01:10 10
2012-01-01 00:01:20 10
2012-01-01 00:01:30 10
Freq: 10S, dtype: int64
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.11.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
pandas: 0.18.0
nose: 1.3.7
pip: 8.1.1
setuptools: 20.3
Cython: 0.23.4
numpy: 1.10.4
scipy: 0.17.0
statsmodels: 0.6.1
xarray: None
IPython: 4.0.1
sphinx: 1.3.1
patsy: 0.4.0
dateutil: 2.5.1
pytz: 2016.2
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.4.4
matplotlib: 1.5.0
openpyxl: 2.2.6
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.7.7
lxml: 3.4.4
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.9
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.38.0